Help With Print Report for an Array

This is what I so far! I need help printing a report that looks like this :

Class Report

Test # Test Score
1 97
2 85
3 90
4 79
5 88


Class Average is 87.8



..... I Think I need to use a For Loop but i am not sure.. please help!!!




#include <iostream>
#include <iomanip>

using namespace std;

//function prototypes

void GetData(int TestScoresf[], int &indexf);
float ComputeAvg(int TestScore[], int indexf);
void PrintReport(int TestScore[], int indexf, float ClassAverage);

//constant indentifiers

const int MAXSIZE=10;

// Main Body
void main()
{
int TestScores[MAXSIZE];
int index;
float ClassAverage;

//Function Calls
GetData(TestScores, index);
ClassAverage= ComputeAvg(TestScores, index);
PrintReport(TestScores, index, ClassAverage);
return;
}//end Main Body

// Function Definitions
void GetData(int TestScoresf[], int &indexf)
{
indexf= -1;
do
{
indexf++;
cout<<"Please Enter Test #"<<indexf+1<<":<-1 to Exit>\t";
cin>>TestScoresf[indexf];
}while(TestScoresf[indexf]>=0);
return;
//end of GetData

float ComputeAvg(int TestScore[], int indexf)
{
int sum=o
float avg;
sum+=TestScoresf[i];
avg=float(sum)indexf;
return avg;

}//end ComputeAvg

void PrintReport(int TestScore[], int indexf, float ClassAverage)

Topic archived. No new replies allowed.