Getting error on cs50 problem set 1 Mario "handles a height of 1 correctly, timed out while waiting for program to exit"
Here's my code:
// to get the positive integer
height = get_int(" Height: ");
height -= 1;
while (height <1 || height > 7);
//building block of super mario
//it is for tracking the height and width
for (int i = 0; i <= height; i++)
//it is for traking spaces
for (int k = height; k > i; k--)
// it is for tracking hashes
for (int j = 0; j <= i; j++)
If the user passes a value of 1 (which is a value the program is supposed to work with), your code decrements it, making it zero. This is then rejected by your bounds test (height <1), so it asks again for input.
Since the program doesn't exit after being given a value of 1, which check50 expects, it gives up waiting after a while.