Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Ex:
  2. alt (altitude) = 12
  3. base = 5
  4.  
  5. output:
  6. xxxxx
  7. xxxx
  8. xxxx
  9. xxxx
  10. xxx
  11. xxx
  12. xxx
  13. xx
  14. xx
  15. xx
  16. x
  17. x
  18.  
  19. The first column and the first row are defined and set by alt and base, respectively.
  20. That leaves the matter of the ‘inner triangle.’
  21. Inner triangle:
  22. w – the width of the inner triangle is base-2
  23. | |
  24. --xxx --
  25. | xxx | n - the height of each box is l/w
  26. | xxx --
  27. | xx
  28. L| xx
  29. | xx
  30. | x
  31. | x
  32. | x
  33. --[space] – box0 – the number of spaces at the end is l%w
  34.  
  35. The length of the inner triangle (L) is alt-2
  36.  
  37. In this case, alt is larger, so n = l/w
  38. box0 = l%w
  39.  
  40. the width of each box is w (reassigned to nn) – 1 for each box until nn = 0
  41.  
  42. the function drawline takes the first value and prints it the second value’s times. The third value is a Boolean value for whether or not a new line is printed at the end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement