So after scratching my head for a long time I figured out the algorithm to approach the "Itsa Mario" program. This is the code I wrote and I am horribly stuck. The compiler gives errors when I try to make or check the file. Is my approach correct? Do I have way too many bugs in my code? Can someone help me out without giving away all the code? Thanks in advance.

[EDIT: functional code removed for Honor Code compliance.]

  • Please make sure your code is presented in a structured way so we can easily review it. In it's current state, it is really hard to check for bugs in your program. Your syntax looks correct, so the error will probably be in your program structure. If you edit your code so it looks the same way as in your IDE I will have another look at it. – T_Wess Sep 19 '16 at 9:35

while ( (height < 0 ) || (height > 23 ) );

if( height >=0 && height <= 23)

The second line seems to be unnecessary.

The first line is part of a do while loop. In the do while loop you make sure that the user inputs a number between 0 and 23.

In this second line of code you check the same thing again. I would recommend deleting this line. I have not checked the rest of your code.

I'm not an expert (just in Pset2) :) But I hope I could be of help.

  • Other than the if statement that Joeri discusses being unnecessary, the code is fine. It should compile with no problem. – Cliff B Sep 19 '16 at 16:56

You must log in to answer this question.

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