I just started taking cs50. Just finished water.c and have to start mario.c but I can't figure out how to even start mario.c as in apply what I've learned in the first lecture into this project. It would be great if someone could give an idea of how to begin it because I have no idea what i am doing.


Basically, you'll need a few loops.

First, you need a loop that keeps repeating until the user enters a valid height. You'll have to ask at least once.

Then, you most likely want a loop that represents the line (so runs as many times as lines are expected).

Nested within this outer loop, you could have one or more inner loops (all on same level, so maximum nesting level of two), printing a single space or hash on each iteration. The challenge is calculating the right number of spaces and hashes from the current line index and total height.

Also, you need to make sure each line ends with a newline ('\n').

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .