// Mr. Minich
// CMPSC 201 // Ch. 11 Demo Program #4
// January 20, 2000
// Purpose - to illustrate the use of parallel arrays
#include <iostream>
using namespace std; int main() { int position = 0; int runningTotal = 0; int count = 0; int goodGames[101] = {0}; // keeps track of scores over 200 int gameScores[101] = {0}; // it is assumed that the user // will not need to enter more // than 100 game scores // goodGames and gameScores are used as parallel arrays do { count++; // we are not going to make use of the // zero position of the array cout << "Enter the score of Game " << count << " (-99 to stop): "; cin >> gameScores[count];
if (gameScores[count] != -99) { runningTotal = runningTotal + gameScores[count]; }
if (gameScores[count] >= 200) { goodGames[count] = 1; }
} while(gameScores[count] != -99); cout << "Your average score was " << runningTotal / --count << endl; cout << "You bowled 200 or better in the following games: "; for (int i = 0; i <= count; i++) // count was decremented above // and now reflects the correct // number of games. { if (goodGames[i] == 1) {      cout << i << " "; }

} cout << endl;
return 0; }// end of main