|
-
Aug 30th, 2002, 08:49 AM
#1
Thread Starter
New Member
Using cin and while to loop until done
Hello: the following code is meant to capture grade data input in a console application. After that data for one student has been captured, the application askes whether data for another student should be captured. The program uses a while loop, where the boolean "newStudent" should determine whether to re-loop or proceed to the last steps of the program. I do not think that the input section at the end of the while loop is working?
int main() {
bool newStudent=true;
int resp;
while(newStudent) {
get grade data and put into vectors--this all seems to work
cout << "Will there be another student's grades? " << endl;
cout<<"If yes, type 1. If no, type 0."<<endl;
cin >> resp;
if (resp == 1) newStudent = true; else newStudent=false;
}
DISPLAY THE RESULTS
getch();
return 0;
} // end of main
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|