0

I was just wondering the cause for the reason why mario.c fails to take a value of 1, 2 and 23 and rejects 24. In my tested version, it manages to successfully print out the expected output and it also includes a while loop if the value is greater than 23. However, the CS50 Gradebook doesnt seem to recognize it. Am I doing something wrong? Thanks!

Code:

[EDIT: unrelated code deleted for Honor Code Compliance.]

for(int i = 0; i < height; i++) //Go down the lines
{
    for (int j = 0; j < index; j++) //number of spaces
        printf(" ");

    ...

    printf("\n");   //New line
    index--;
}
}
1
  • 1
    Can you share a sandbox link to the check50 results, please?
    – Sam Gerber
    Commented Oct 22, 2015 at 2:24

1 Answer 1

0

All the pyramids fail, right? That's because check50 expects very exact results. If there are any extra or missing characters, spaces, line feeds, prompts, or anything else, it rejects it.

You have an extra leading space at the beginning of every line of every pyramid.

If this answers your question, please click on the check to accept. Let's keep up on forum housekeeping. ;-)

1
  • Thank you very much :) Commented Oct 22, 2015 at 22:18

You must log in to answer this question.

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