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
|
//Program to compute and display the average and appropriate letter grade of 3 test scores
#include<iostream>
using namespace std;
void ComputeAvg(int Test_1, int Test_2, int Test_3)
{
double Avg;
double ComputeAvg(int Test_1,int Test_2,int Test_3);
{
Avg=ComputeAvg(Test_1,Test_2,Test_3);
return(Test_1+Test_2+Test_3)/3.0;
}
}
int main()
{
int Test_1,Test_2,Test_3,n;
double Avg;
for(n=1;n<=5;n++)
{
do
{
cout<<"What are the three test scores for student #"<<n;
cin>>Test_1>>Test_2>>Test_3;
if(Test_1<1||Test_1>100||Test_2<1||Test_2>100||Test_3<1||Test_3>100)
cout<<"You entered an invalid score - please try again"<<endl;
}
cout<<"Your test average is:"<<Avg<<endl;
ComputeAvg(Test_1,Test_2,Test_3);
}
}
#include<iostream>
using namespace std;
void LetterGrade(int Test_1, int Test_2, int Test_3)
{
double Avg;
double LetterGrade(int Test_1,int Test_2,int Test_3);
{
Grade=LetterGrade(Test_1,Test_2,Test_3);
|