Whenever I do check50 on this code, it gives me lots of errors, and I'm not sure what I'm doing wrong.
3 Answers
Your loops mean that you don't print out the right number of # signs. Because your i starts of at 0, on the first pass j = 0 which equals i and so only one pass is printed.
Therefore you need to change the initial value of i and your limit so that on each pass, 2, then 3, then 4 etc. # signs are printed instead of 1, then 2, then 3 etc.
Below is the expected out put. Note the difference to yours - hint in the pset itself (quoted).
jharvard@appliance (~/dropbox/pset1): ./mario
height: 8
##
###
####
#####
######
#######
########
#########
Note that the rightmost two columns of blocks must be of the same height. No need to generate the pipe, clouds, numbers, text, or Mario himself.
Take a closer look at your two nested for loops.
Start with the first nested for loop and run through your code in your head. How many spaces does this loop print out? How many spaces does the problem require for the first row? Now increase i by one and go through the same process for the second row. Notice any differences between the expected code and yours?
Now move onto the second nested for loop. How many "#" does your for loop print out on the first iteration? How many "#" does the question require for the first row? Do these two values match? Increase i by one and go through the same process for the second row.
Hint: Go and watch the Mario walkthrough. This will tell you all the values you will need.