code is at bottom
i have to make the program below display lettergrade next to average and ask for the grades in a loop can anyuone help me please
btw this is how im getting graded
i will get a 70 if program ask the user for the number of grade. use a loop to ask for grades and add them together.
(70 is all i need)
85: the number of grade as you go use a loop to ask for grades
ex:what is grade1?
what is grade2?
100: do the 85 except:
what is the 1st grade?
what is the 2nd grade?
what is the 3rd grade?
please somebody help me.
Code:
#include <iostream>
using namespace std;
void output(double avg1, char lg)
{
cout<<" your average is "<<avg1;
}
double calc(int numg, double s){
return s/numg;
}
void input( int &numg, double &s){
int counter=0;
do{
cout<<"enter the number of grades you will be entering"<<endl;
cin>>numg;
cout<<"what is grade "<<s*counter<<endl;
s=s+numg;
}
while (counter<numg);
}
char lettergrade(double avg){
if(avg>=93){
return ('A');
}
else if((avg>=85) && (avg<=93)){
return ('B');
}
else if(avg>=77 && (avg<=85)){
return ('C');
}
else if((avg>=70) && (avg<=77)){
return ('D');
}
else{
return ('F');
}
}
int main(){
int numgrade;
char lettergrade;
double average;
double sum;
input(numgrade,sum);
output(average,lettergrade);
return 0;
}