// Mr. Minich
// CMPSC 101
// Ch. 10 Demo Program #5
// January 20, 2000
// Purpose - to illustrate the use of a two-dimensional array.
#include <iostream>
using namespace std;
const int NUM_BOWLERS = 5; // numbeer of bowlers per team
const int NUM_GAMES = 6; // number of games bowled per bowler
int main()
{
int games[NUM_BOWLERS][NUM_GAMES];
int row = 0;
int col = 0;
int num = 0;
int total = 0;
for (row = 0; row < NUM_BOWLERS; row++)
{
for (col = 0; col < NUM_GAMES; col++)
{
cin >> games[row][col];
}
}
cout << "Enter your bowler number: ";
cin >> num;
for (col = 0; col < NUM_GAMES; col++)
{
total = total + games[num - 1][col];
}
cout << "Your average is " << double (total) / NUM_GAMES << endl;
// neatly displaying all bowling scores
for (row = 0; row < NUM_BOWLERS; row++)
{
for (col = 0; col < 6; col++)
{
cout << games[row][col] << '\t';
}
cout << endl;
}
return 0;
}// end of main