world of CS50!
Having issues passing check50's tests for mario. I looked at other issues, including ones that look the same as mine, but I haven't found a solution.
My code seems to give the desired results as shown on the pset1 specification page. I also entered 0, and a white space and my program rejected them and asked for input again.
My program's output:
Height: -1
Height: -2
Height: foo
Retry: bar
Retry: 1
##
Retry: 8
##
###
####
#####
######
#######
########
#########
However, when I run the check50 I get this:
jharvard@appliance (~/Dropbox/pset1): check50 /2014/x/pset1/mario mario.c
:) mario.c exists
:) mario.c compiles
:( rejects a height of -1
\ expected output, not standard error of "TERM environment variable not set.\n"
:( handles a height of 0 correctly
\ expected output, not standard error of "TERM environment variable not set.\n"
:( handles a height of 1 correctly
\ expected output, not standard error of "TERM environment variable not set.\n"
:( handles a height of 2 correctly
\ expected output, not standard error of "TERM environment variable not set.\n"
:( handles a height of 23 correctly
\ expected output, not standard error of "TERM environment variable not set.\n"
:( rejects a height of 24
\ expected output, not standard error of "TERM environment variable not set.\n"
:( rejects a non-numeric height of "foo"
\ expected output, not standard error of "TERM environment variable not set.\n"
:( rejects a non-numeric height of ""
\ expected output, not standard error of "TERM environment variable not set.\n"
https://sandbox.cs50.net/checks/1939b97b24fc4e79915e6ebba4f73bf0
I searched for TERM environment variable not set.\n
, but found nothing.
What am I missing here?
Thanks for looking, I appreciate any help :)
SOLUTION:
As Kareem pointed out, there were two issues with my code.
- Using a system call in my code:
system("clear");
- Removed this line completely. Probably an issue with server rights.
- Excluding 0 as a valid user input. My code simply didn't follow all of the instructions.
- Removed the "=" in the line
} while((num <= 0)||(num > 23));
- It now reads:
} while((num < 0)||(num > 23));
- Removed the "=" in the line
Once both were resolved, check50 returned all green happy faces :)