Questions tagged [water]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
47 views

CS50 pset 1 water negative integers

Below is my code for the pset 1, im not sure why but whenever i put negatives for the "Minutes" i get a negative "Bottles" rather than an error. Help would be appreciated. #include <cs50.h> #...
0
votes
1answer
137 views

Pset1 Water Issue, reprompting with “Retry: ” for Non-integers, and “Minutes: ” for negative integers

My water program seems to work decently, it passes all of the check50 tests just fine. My issue is that when the user enters a negative integer, the program re-prompts with "Minutes; ", but when the ...
0
votes
2answers
218 views

unused variable error

I've tried many variations, listened to the lecture twice, the walkthrough many times and the YouTube videos on C but still can't get the seemingly simple water problem to work. Please explain where I'...
0
votes
1answer
107 views

pset1 water get_int() problem

Whenever I introduce int get_int() I get an error message: error: initializer element is not a compile-time constant int x = get_int()I have tried permutations of get_int(0 that have been suggested ...
0
votes
2answers
93 views

PSet 1, Trying to add a loop to Water

Right now I'm just playing about and trying to add various things to Water, just to get a hang of them. It's probably to over-engineered to get a pass or anything, but oh well. I'm trying to add a ...
0
votes
2answers
248 views

My pset1 Water Code Works as per the Spec, but Doesn't Pass the Check50

so I am very new to this but I have written some code to complete the pset1 water task and it just won't pass through check50 2016.water water.c. I have put it below, I understand that it maybe all ...
0
votes
1answer
628 views

What is the proper way to use “do while” loop for Pset1 water

I am a complete newbie to CS50 and programming. I entered in my basic code and ran the program and CS50check and it was all good. The I tried many times to include this do while loop, reviewed notes, ...
0
votes
2answers
369 views

Do-while loop in pset1 returning negatives

I can't get the do-while loop in water to work. It will take a positive number and then return the right thing and quit the program, but if given a negative number it spits out a negative water amount ...
0
votes
1answer
597 views

Can't get the do-while loop to work in pset1

I have been trying to follow the walk through for pset1 and I cannot get my code to work for the first part of water. It will not let me execute the do-while loop. I have written the code just like ...
0
votes
1answer
376 views

pset1 water help please! simple question

I am following the walk-through video for water, and it's very straight forward which is why this is frustrating me so much. I create the file integer.c and input the code as instructed, however it ...
0
votes
2answers
336 views

(PSET 1) Creating functions for water.c. Dont understand how this function worked. (Contains pset answer)

I'm doing water.c of pset1 and wanted to use functions to practice and understand it more. After getting so many errors, I finally got it to work but I don't understand why and how it worked. How is '...
0
votes
2answers
497 views

Questions regarding Pset1 water.c

Hi so I figured out the water.c problem but aside from the requirements, I want the user to input the positive number only (the program will keep asking the user to input "Minutes: " again and again ...
0
votes
1answer
437 views

Can't figure out this problem with water.c = error: expected identifier or '('

This is my current code for water.c #include <stdio.h> #include <cs50.h> //This calculates how many bottles of water is used in the shower int main (void); { do { Print("...
-1
votes
2answers
248 views

pset 1 water fails check50 “rejects ”foo“ minutes”

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 "...
0
votes
2answers
494 views

My water.c program won't compile - Pset1

I don't think I have using the whole "%" and "int" thing properly? I'm also not sure how to remove the formatting from the error message in this forum post, sorry. Here is my code: #include <...
1
vote
1answer
374 views

PSET1 - Water fails check50: “expected prompt for input, not exit code of 0”

I'm working on PSET1's Water problem. Here's my code: #include <stdio.h> int main(void) { int m, b; printf("minutes: "); scanf("%d", &m); b = m * 12; printf("bottles: %d\n", b); } Check50 ...
1
vote
3answers
4k views

water week 1 problem

I'm stuck in water week 1 problem. My program works according to the check50 but I have it gives me 3 errors which I have no clue what they mean: :( rejects "foo" minutes /expected prompt for input, ...
0
votes
3answers
748 views

Infinite looping in hacker 1 - water

My do-while loop successfully rejects negative numbers and 0, however, if I input text such as "foo" when prompted for the length of a shower in minutes, the program runs into an infinite loop, ...