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;
}