//create function prototypes
void GetNames(string[],int);
void GetScores(double[],int);
double* GetAverage(double**, int);
void PrintAll(string[],double[],double*,string[],int);
int main()
{
char choice;
do{
//declare variables and knowns
int people;
double* average;
cout<<"In this program the data from a contest will be organized."<<endl;
cout<<"How many people were involved in the contest ?:";
cin>>people;
cout<<endl;
//create the dynamic arrays
string* names = new string[people];
double* scores = new double[people];
string above_below [people];
//fill the arrays
GetNames(names,people);
GetScores(scores,people);
//create a new pointer
double **ptr;
ptr = &scores;
//find the average
average = GetAverage(ptr,people);
//checks if scores are below or above average
for(int i = 0; i<people;i++)
{
if(scores[i]<*average)
{
above_below[i]="Below Average";
}
else if(scores[i]>*average)
{
above_below[i]="Above Average";
}
else
cout<<endl;
}
//print the results
PrintAll(names,scores,average,above_below,people);
do
{
cout<<"Do you want to go again ?(y/n):";
cin>>choice;
cout<<endl;
}while(choice!='y');
}while(choice=='y');
system("pause");
return 0;
}
//function used to get names
void GetNames(string names[],int people)
{
for(int i = 0; i<people;i++)
{
cout<<"Enter the name of contestant "<<" #"<<i+1<<" :";
cin.ignore('\n');
cin.clear();
cin>>names[i];
cout<<endl;
}
}
//function used to get the scores
void GetScores(double scores[],int people)
{
cout<<"The scores will have to be from 0 to 100"<<endl;
for(int i = 0;i<people;i++)
{
do
{
cout<<"Enter the scores of contestant "<<" #"<<i+1<<" :";
cin>>scores[i];
}while(scores[i]>=0&&scores[i]<=100);
cout<<endl;
}
}
//function used to get the average
double* GetAverage(double ptr[],int people)
{
//declare local variables
double sum = 0;
double avg;
//change people variable into a double to get an accurate value for avg
for(int i = 0; i<people; i++)
{
sum = ptr[i]+sum;
}
avg = sum/people;
double* avg1;
avg1 = &avg;
return avg1;
}
//function that will print all
void PrintAll(string names[],double scores[],double average,string
above_below[],int people)
{
cout<<"Average :"<<fixed<<setprecision(2)<<average<<endl;
cout<<"Names"<<right<<setw(30);
cout<<"Scores"<<right<<setw(30);
cout<<"Above/Below"<<endl;
cout<<endl;
for(int i = 0; i<people;i++)
{
cout<<names[i]<<right<<setw(30)<<scores[i]<<right<<setw(30)
<<above_below[i]<<endl;
//create function prototypes
void GetNames(string[],int);
void GetScores(double[],int);
double* GetAverage(double**, int);
void PrintAll(string[],double[],double*,string[],int);
int main()
{
char choice;
do{
//declare variables and knowns
int people;
double* average;
cout<<"In this program the data from a contest will be organized."<<endl;
cout<<"How many people were involved in the contest ?:";
cin>>people;
cout<<endl;
//create the dynamic arrays
string* names = new string[people];
double* scores = newdouble[people];
string above_below [people];
//fill the arrays
GetNames(names,people);
GetScores(scores,people);
//create a new pointer
double **ptr;
ptr = &scores;
//find the average
average = GetAverage(ptr,people);
//checks if scores are below or above average
for(int i = 0; i<people;i++)
{
if(scores[i]<*average)
{
above_below[i]="Below Average";
}
elseif(scores[i]>*average)
{
above_below[i]="Above Average";
}
else
cout<<endl;
}
//print the results
PrintAll(names,scores,average,above_below,people);
do
{
cout<<"Do you want to go again ?(y/n):";
cin>>choice;
cout<<endl;
}while(choice!='y');
}while(choice=='y');
system("pause");
return 0;
}
//function used to get names
void GetNames(string names[],int people)
{
for(int i = 0; i<people;i++)
{
cout<<"Enter the name of contestant "<<" #"<<i+1<<" :";
cin.ignore('\n');
cin.clear();
cin>>names[i];
cout<<endl;
}
}
//function used to get the scores
void GetScores(double scores[],int people)
{
cout<<"The scores will have to be from 0 to 100"<<endl;
for(int i = 0;i<people;i++)
{
do
{
cout<<"Enter the scores of contestant "<<" #"<<i+1<<" :";
cin>>scores[i];
}while(scores[i]>=0&&scores[i]<=100);
cout<<endl;
}
}
//function used to get the average
double* GetAverage(double ptr[],int people)
{
//declare local variables
double sum = 0;
double avg;
//change people variable into a double to get an accurate value for avg
for(int i = 0; i<people; i++)
{
sum = ptr[i]+sum;
}
avg = sum/people;
double* avg1;
avg1 = &avg;
return avg1;
}
//function that will print all
void PrintAll(string names[],double scores[],double average,string
above_below[],int people)
{
cout<<"Average :"<<fixed<<setprecision(2)<<average<<endl;
cout<<"Names"<<right<<setw(30);
cout<<"Scores"<<right<<setw(30);
cout<<"Above/Below"<<endl;
cout<<endl;
for(int i = 0; i<people;i++)
{
cout<<names[i]<<right<<setw(30)<<scores[i]<<right<<setw(30)
<<above_below[i]<<endl;
}
delete names;
delete scores;
}
Your compiler already told you where the issue is : It's where you call/define void PrintAll(string[],double[],double*,string[],int);
your definition of the function and the function itself has 2 different sets of arguments. Your compiler is saying that the function your calling isn't defined because of this.