Check50 is telling me that greedy is providing incorrect output for several inputs (0.15, 1.6, 23, and 4.2) even though I get the correct output for those inputs when I run the program myself:
jharvard@appliance (~/Dropbox/pset1): make greedy1
make: 'greedy1' is up to date.
jharvard@appliance (~/Dropbox/pset1): ./greedy1
Oh hai! How much change is owed?
.15
2
jharvard@appliance (~/Dropbox/pset1): ./greedy1
Oh hai! How much change is owed?
1.6
7
jharvard@appliance (~/Dropbox/pset1): ./greedy1
Oh hai! How much change is owed?
23
92
jharvard@appliance (~/Dropbox/pset1): ./greedy1
Oh hai! How much change is owed?
4.2
18
jharvard@appliance (~/Dropbox/pset1): check50 2014/x/pset1/greedy greedy.c
:) greedy.c exists
:) greedy.c compiles
:) input of 0.41 yields output of 4
:) input of 0.01 yields output of 1
:( input of 0.15 yields output of 2
\ expected output, but not "32769\n"
:( input of 1.6 yields output of 7
\ expected output, but not "32774\n"
:( input of 23 yields output of 92
\ expected output, but not "32859\n"
:( input of 4.2 yields output of 18
\ expected output, but not "22\n"
:) rejects a negative input like -1
:) rejects a non-numeric input of "foo"
:) rejects a non-numeric input of ""
Link to check50 results on sandbox.cs50.net
I have looked at a number of similar issues other users have had with check50 for greedy, including:
- Why Does greedy Fail Passing check50 Tests
- Why Do I Get Errors When Checking greedy with check50?
- Final line format for greedy OK but check50 says: expected output, but not "0\n"
- pset1 rejects greedy even if the correct answer is displayed
I can say with confidence that my final line syntax is fine, my code appears to adhere to the specifications and the answers I get are correct.
I've been over my code again and again, and I cannot figure out why check50 seems to think that the output from these inputs is different from the output I am getting on the screen when I run the program. Any insights would be very truly appreciated!