My output was okay but it showed this error.
:( rejects "foo" minutes
\ expected prompt for input, not exit code of 0
:( rejects "" minutes
\ expected output, not a prompt for input
:( rejects "123abc" minutes
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.
Sign up to join this communityin 2017 the GetInt() function is depreciated
water.c:8:9: warning: 'GetInt' is deprecated [-Wdeprecated-declarations]
now use
get_int();
It works for:-
note: view the Walkthrough video.
You would need to use cs50's GetInt() function to get the user input. Using scanf - which is what I did wrong to get user input produces the error above.
To solve this, do the following. If you are using the cs50 appliance or IDE go to step 2. If you are using your system or anything else start with step 1.
You have install the cs50 library on your system here.
Add #include <cs50.h>
at the top of the file.
Compile using clang -o -g -Wall water.c -o water -lcs50 or gcc -g -Wall water.c -o water -lcs50 (if you want to use gdb)
I hope it works for you!