// function prototypes
void GetData(int TestScoresf[]);
void ComputeAvg(int TestScoresf[],float &Avgf);
void PrintReport(int TestScoresf[],float Avgf);
// main program
int main()
{
// local identifiers
int TestScores[MAXSIZE];
float Avg;
//Input modale
GetData(TestScores);
//processing module
ComputeAvg(TestScores,Avg);
//output module
PrintReport(TestScores,Avg);
system ("PAUSE");
return 0 ;
}//end main
// function definitions
void GetData (int TestScores[ ])
{
for (int i=0; i <MAXSIZE; i++)
{
cout<<"please enter the test score #"<<i+1<<":\t";
cin>>TestScores[i];
}
return;
}
// end GetData
void ComputeAvg( int TestScoresf[],float&Avgf)
{
int sum = 0;
for(int i=0; i <MAXSIZE; i++)
{
sum = TestScoresf[i];
}
Avgf = float(sum)/MAXSIZE;
return;
} //end ComputeAvg
void PrintReport (int TestScoresf[], float Avgf)
{
cout<<setw(23)<<"Test#"<<setw(15)<<"Test…
cout<<"\n\n";
for(int i = 0; i <MAXSIZE; i ++)
{
cout<<setw(26)<<i+1<<setw(20)<<TestScore…
}
cout<<"\n\n"<<fixed<<showpoint<<setpreci…
cout<<"test score average:\t"<<Avgf<<endl;
return;
}
// end print Report
void printsorted (int TestScoresf[])
{
return ;
}
// compiler directives
#include <iostream>
#include<iomanip>
#include<stdio.h>
usingnamespace std;
// constant identifiers
constint MAXSIZE = 10;
// function prototypes
void GetData(int TestScoresf[]);
void ComputeAvg(int TestScoresf[],float &Avgf);
void PrintReport(int TestScoresf[],float Avgf);
// main program
int main()
{
// local identifiers
int TestScores[MAXSIZE];
float Avg = 0;//remember to set equal to 0
//Input modale
GetData(TestScores);
//processing module
ComputeAvg(TestScores,Avg);
//output module
PrintReport(TestScores,Avg);
// system ("PAUSE"); REMOVE THIS
return 0 ;
}//end main
// function definitions
void GetData (int TestScores[ ])
{
for (int i=0; i <MAXSIZE; i++)
{
cout<<"please enter the test score #"<<i+1<<":\t";
cin>>TestScores[i];
}
return;
}
// end GetData
void ComputeAvg( int TestScoresf[],float&Avgf)
{
int sum = 0;
for(int i=0; i <MAXSIZE; i++)
{
sum += TestScoresf[i];//change to += otherwise you are replacing the value each time
}
Avgf = float(sum)/MAXSIZE;
return;
} //end ComputeAvg
void PrintReport (int TestScoresf[], float Avgf)
{
cout<<setw(23)<<"Test#"<<setw(15)<<"Test…";
cout<<"\n\n";
for(int i = 0; i <MAXSIZE; i ++)
{
cout<<setw(26)<<i+1<<setw(20)<<TestScoresf;
}
cout<<"\n\n"<<fixed<<showpoint<<setprecision(3);
cout<<"test score average:\t"<<Avgf<<endl;
return;
}
// end print Report
void printsorted (int TestScoresf[])
{
return ;
}