I was so happy that I finally finished the mario en greedy pset. It compiled and worked fine. But when I try to check the mario pset with cs50 check, it gives me these errors:
:) mario.c exists
:) mario.c compiles
:) rejects a height of -1
:) handles a height of 0 correctly
:( handles a height of 1 correctly \ expected output, but not "## \n"
:( handles a height of 2 correctly \ expected output, but not " ## \n### \n"
:( handles a height of 23 correctly \ expected output, but not " ## \n ..."
:( rejects a height of 24 \ expected output, but not " ## \n ..."
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""
This is my code:
int main(void)
{
//Prompts the users for a height value
int height;
do
{
printf("Height: ");
height = GetInt();
}
while (height < 0 || height >= 24);
//Prints half-pyramid with chosen valuess
for (int row = 0; row < height; row++)
{
for (int spaces = height; spaces - 1 > row; spaces--)
{
printf(" ");
}
for (int column = 0; column < row + 2; column++)
{
printf("#");
}
printf(" \n");
}
}
Could someone else try to compile it and test it and give me some feedback? Thanks for the help!