Quote Originally Posted by feckless View Post
You have called scanf() twice. First is the line right after the first printf (prompting user for shower length) and then right after again using check variable. As far as the program is concerned, you have asked for user input twice (for the same question and same variable). You can eliminate one. Actually...


Very basic user input verification would utilize something like the while loop.

For instance, instead of having a variable to check the truth of the scanf input (that is, to verify whether or not user inputs an integer), you can combine them into something like:

Code:
printf("How many minutes does your average shower last? (q to quit)\n");
while ((scanf("%i", &showerTime)) == 1)
{
    blah blah blah
}
Since you are aware of "the truth" in C, you can see that the while loop will continue to execute so long as that particular scanf evaluates to 1 (that is, user inputs an integer). At this point, if the user printed anything other than an integer value, the program would cease. If the user inputs an integer, prompt the user after a run through to enter another value.

A method like this is crude, of course, simply because you don't give the user another chance to input something correctly. But it's an example. Try looking at other forms of input and input verification.

Thanks! So I fixed the first part, with your help. However, I'm still having issues with the input verification part. It's not so much an issue with getting separate feedback if the user puts in incorrect information rather than correct information, but rather getting the function to loop back to the start if it is an incorrect input.