C++ Question....thanks for any help you can give
C++ Question....thanks for any help you can give
I only took 1 C++ class and am trying to remember how to write code to reloop my code. I wrote a program that asks the user to answer 5 questions, and it tells them which weather model to use based on the answers they submit. But I don't remember how to make code so that I can ask at the end if they want to test another time. Basically I have an output statement asking "Would you like to test another model (Y=Yes, N=No)" but I don't know the code to actually go through the code again. Thanks for the help
RE:C++ Question....thanks for any help you can give
char c;
do {
... code ...
printf("Again (Y/N)? ");
scanf("%c", c);
} while (c != 'y' && c != 'Y');
do {
... code ...
printf("Again (Y/N)? ");
scanf("%c", c);
} while (c != 'y' && c != 'Y');
RE:C++ Question....thanks for any help you can give
You probably ment:
char c;
do {
... code ...
printf("Again (Y/N)? ");
scanf("%c", &c);//!!!!!!! &c not c
} while (c != 'y' && c != 'Y');
Anton.
char c;
do {
... code ...
printf("Again (Y/N)? ");
scanf("%c", &c);//!!!!!!! &c not c
} while (c != 'y' && c != 'Y');
Anton.