int scores;
cout<<"Please enter five test scores"<<endl;
cin>>scores;
cin>>scores;
cin>>scores;
cin>>scores;
cin>>scores;
double average = (scores+scores+scores+scores+scores)/5;
Should be :
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int scores, total = 0;
cout<< "Please enter five test scores : " << endl;
cin>>scores; total += scores;
cin>>scores; total += scores;
cin>>scores; total += scores;
cin>>scores; total += scores;
cin>>scores; total += scores;
double average = (total) / 5.0;
#include <iostream>
#include <iomanip>
usingnamespace std;
void input (int grade, int add, int gradeone, int gradetwo, int gradethree, int gradefour, int gradefive) {
cout<<"Input five grades "<<endl;
cin>>gradeone;
cin>>gradetwo;
cin>>gradethree;
cin>>gradefour;
cin>>gradefive;
double average= (gradeone+gradetwo+gradethree+gradefour+gradefive)/5;
}
int main () {
double average;
if( average < 60)
{
cout<<"Your average is an F."<<endl;
}
elseif( average >= 60 && average<= 69)
{
cout<<"Your average is a D."<<endl;
}
elseif( average >= 70 && average<= 79)
{
cout<<"Your average is a C."<<endl;
}
elseif( average >= 80 && average <= 89)
{
cout<<"Your average is a B."<<endl;
}
elseif( average >= 90 && average<= 100)
{
cout<<"Your average is an A."<<endl;
}
else
{
cout<<"you are bad student with no grades"<<endl;
}
return 0;
}
void output(double average){
cout.setf(ios::showpoint|ios::fixed);
cout<<setprecision(1);
cout<<"Your grade Average is "<<setw(8)<<average <<endl;
}
void input (int grade, int add, int gradeone, int gradetwo, int gradethree, int gradefour, int gradefive) {
cout<<"Input five grades "<<endl;
cin>>gradeone;
cin>>gradetwo;
cin>>gradethree;
cin>>gradefour;
cin>>gradefive;
double average= (gradeone+gradetwo+gradethree+gradefour+gradefive)/5;
}
Should be :
1.
1 2 3 4 5 6 7 8 9 10 11
void input (double &average) {
int gradeone; int gradetwo; int gradethree; int gradefour; int gradefive;
cout<<"Input five grades "<<endl;
cin>>gradeone;
cin>>gradetwo;
cin>>gradethree;
cin>>gradefour;
cin>>gradefive;
average= (gradeone+gradetwo+gradethree+gradefour+gradefive)/5;
}
2.
1 2 3 4 5
int main () {
double average;
input(average);
Where in your code did you call the function input()??