// // Filename: pgm2_3b.cpp // // Description: Demonstration of a while statement to collect a sequence // of input data from the user. // // ENSC 104: Digital Computer Programming // // Instructor: Dr. Walsh // // Section: 2 // // Date Created: 01/29/98 // Last Modified: 01/29/98 // // Name: N/A // #define NUM_SCORES 5 #include main() { int score; int total=0; int count=0; while( count < NUM_SCORES ) { cout << "Enter an exam score: "; cin >> score; total = total + score; count++; } cout << "\n\nYou entered " << count << " scores\n"; cout << "The average score is " << total/count << endl; return 0; }