I don't understand what I am doing wrong:
I'm developing a program for a school project and it's just not working. I need to get a player's age, and a player's nine scores (which I have), then I have to find what age group they are in (which I know), then I have to compare their scores to the scores that are predetermined for their age group which are stored in a constant 2D Array. Then I have to print if they were "Over", "Under", or "Par" an EACH hole number. The age groups are the rows and the holes are the columns in this constant array. See what I have and PLEASE tell me what is going on in the most basic C++ you know. I'm about ready to pull my hair out!
#include<iostream>
using namespace std;
int main() {
const int PAR[5][9] = {{8, 8, 9, 7, 5, 7, 8, 5, 8},
{7, 7, 8, 6, 5, 6, 7, 5, 6},
{6, 5, 6, 5, 4, 5, 5, 4, 5},
{5, 4, 4, 4, 3, 4, 3, 3, 4},
{4, 3, 3, 3, 2, 3, 2, 3, 3}};
int scores[9] = {5, 6, 4, 3, 2, 1, 8, 6, 4};
int i;
int hole = 0;
int age = 8;
int row;
int x;
int AGE_GROUP[5] = {1, 2, 3, 4, 5};
int AGE_RANGE[5] = {0, 5, 8, 12, 16};
for ( i = 0; i < 9; i++) {
cout << "Enter a score: ";
}
for (i = 0; i < 9; i++) {
cout << scores << " ";
}
cout << endl;
x = 5 - 1;
while (age < AGE_RANGE[x]) {
x = x - 1;
}
cout << age << " is in group number " << AGE_GROUP[x] << endl;
AGE_GROUP[age] = row;
while (hole < 9) {
if (scores[hole]> PAR[row][hole]) {
cout << "Over";
}
else if (scores[hole] == PAR[row][hole]) {
cout << "Par";
}
else if (scores[hole] < PAR[row][hole]){
cout << "Under";
}
hole++;
}
cout << endl;
system("PAUSE");
return 0;
}