# Having a little trouble with my first array

• 10-21-2004
dAzed
Having a little trouble with my first array
This program was working fine until i added the highest score function
something about local function definitions are illegal???

As always help is greatly appreciated thanks for any many times over!!

Code:

``` #include <iostream> using namespace std; //**********************************************Function prototypes void enterScore(int score[]);  void averageScore(int score[]); void highestScore(int score[]);   //**********************************************Function main void main() {         int score[5]; enterScore(score); averageScore(score); highestScore(score); } //*************************enter score function******************************************** void enterScore(int grade[])         {         for (int x = 0; x<5; x++) {         cout << "\nEnter score #"<<" ";         cin >> grade[x];                         } } //**************************average score function******************************************* void averageScore(int num[]) {         int tot = 0;         int avg = 0;         for (int x=0; x<5; x++)                            tot+=num[x];                 avg = tot/5;         cout <<"\n" << tot <<" is the total of the test scores. "<<"\n";         cout <<"\n" << avg <<" is the average test score. "<<"\n"; //***************************highest score function****************************************** void highestScore (int exam[])     {                                                                //local function definitions are illegal???               for (int x=0; x<5; x++)           {               if (exam[x] > highestScore)               highestScore = exam[x];           }     }                                cout <<"\n" << highestScore <<" is the highest test scores. "<<"\n";                         return; }```
• 10-21-2004
Elhaz
Hi dAzed,

You missed the closing curly bracket } at the end of void averageScore(int num[]) - it thinks you're trying to declare void highestScore (int exam[]) in void averageScore(int num[]).
• 10-21-2004
louis_mine
cout <<"\n" << tot <<" is the total of the test scores. "<<"\n";
cout <<"\n" << avg <<" is the average test score. "<<"\n";
there´s a } sign missing, also, in the last funcyion I believe you close a bracket } you never opened
• 10-21-2004
JaWiB
>>void main()

```    #include <iostream>     using namespace std;         //**********************************************Func  tion prototypes     void enterScore(int score&#091;&#093;);      void averageScore(int score&#091;&#093;);     void highestScore(int score&#091;&#093;);         //**********************************************Func  tion main     int main()     {       int score&#091;5&#093;;            enterScore(score);         averageScore(score);         highestScore(score);                 system("pause");         return 0;        }         //*************************enter score function******************************************  **         void enterScore(int grade&#091;&#093;)       {       for (int x = 0; x<5; x++)     {       cout << "\nEnter score #"<<" ";       cin >> grade&#091;x&#093;;               }     }         //**************************average score function******************************************  *     void averageScore(int num&#091;&#093;)     {       int tot = 0;       int avg = 0;           for (int x=0; x<5; x++)                  tot+=num&#091;x&#093;;             avg = tot/5;           cout <<"\n" << tot <<" is the total of the test scores. "<<"\n";       cout <<"\n" << avg <<" is the average test score. "<<"\n";     }    // add }         //***************************highest score function******************************************          void highestScore (int exam&#091;&#093;)     {         int highestScore = 0;         //local function definitions are illegal???         for (int x=0; x<5; x++)          {  if (exam&#091;x&#093; > highestScore)                 highestScore = exam&#091;x&#093;;           }              cout << "\n" << highestScore               << " is the highest test scores. " << "\n";              return;        }```