Hello I have been working on this program I am having trouble compiling it and fixing my errors any suggestions on what to fix would be very helpful Thank You.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
//compiler directives
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
//constant declarations
//function prototype
void GetData(int TestScoresf[], int &NumTestsf);
float ComputeAverage(int TestScoresf[]);
void PrintResults(int TestScoresf[],float Avgf);
//main body
int main ()
{
//local identifiers
float Average;
int TestScores, Numtests;
//function call
GetData(TestScoresf, NumTestsf);
Average = ComputeAverage(TestScores);
PrintResults(TestScores,Average);
cout<<"How many test scores do you have to enter?/n";
cin<< NumTests;
count=0;
while (count++<NumTests);
{
return NumTests;
}
}
//function definitions
void GetData(int TestScoresf[], int &NumTestsf)
{
{
cout<<"Please enter Test Score #:"<<j+1<<"\t";
cin>>TestScoresf[j];
int j=0
while ((TestScoresf[j]>=0)&(j<NumTests))
{
J++;
cout<<"Please enter test score or -1 to exit<<j+1<<:l\t";
cin>>TestScoresf[j];
}
}
return;
}//end function
float ComputeAverage(int TestScoresf[])
{
int sum=0;
float avg;
for(int j=0;j<NumTests;j++)
sum+= TestScoresf[j];
avg = float(sum/NumTests);
return avg;
}//end function
void PrintResults(int TestScoresf[],float Avgf)
{
cout<<"\n\n\n";
cout<<setw(45)<<"GradeReport";
cout<<"\n\n";
cout<<setw(20)<<"Test#"<<setw(25)<<"Test Score";
cout<<endl;
for(int j=0; j<NumTests; j++)
{
cout<<setw(23)<<j+1<<setw(30)<<TestScoresf[j]<<endl;
cout<<"\n The Class Average is:\t";
cout<<fixed<<showpoint<<setprecision(2)<<Avgf<<endl;
return;
}
}
//end of program
|
:\TestScores2.cpp: In function `int main()':
I:\TestScores2.cpp:33: error: `TestScoresf' undeclared (first use this function)
I:\TestScores2.cpp:33: error: (Each undeclared identifier is reported only once for each function it appears in.)
I:\TestScores2.cpp:33: error: `NumTestsf' undeclared (first use this function)
I:\TestScores2.cpp:34: error: invalid conversion from `int' to `int*'
I:\TestScores2.cpp:34: error: initializing argument 1 of `float ComputeAverage(int*)'
I:\TestScores2.cpp:35: error: invalid conversion from `int' to `int*'
I:\TestScores2.cpp:35: error: initializing argument 1 of `void PrintResults(int*, float)'
I:\TestScores2.cpp:38: error: `NumTests' undeclared (first use this function)
I:\TestScores2.cpp:39: error: overloaded function with no contextual type information
I:\TestScores2.cpp:40: error: no post-increment operator for type
I:\TestScores2.cpp: In function `void GetData(int*, int&)':
I:\TestScores2.cpp:53: error: `j' undeclared (first use this function)
I:\TestScores2.cpp:56: error: expected `,' or `;' before "while"
I:\TestScores2.cpp: In function `float ComputeAverage(int*)':
I:\TestScores2.cpp:71: error: `NumTests' undeclared (first use this function)
I:\TestScores2.cpp: In function `void PrintResults(int*, float)':
I:\TestScores2.cpp:87: error: `NumTests' undeclared (first use this function)
I:\TestScores2.cpp:98:1: unterminated comment
Execution terminated