Oct 1, 2012 at 11:18pm UTC
code is at bottom
please help
have to make the program below display lettergrade next to average and ask for the grades in a loop can anyone 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)
i will get a 85: the number of grade as you go use a loop to ask for grades
ex:
what is grade1?
what is grade2?
i will get a 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;
}
Oct 2, 2012 at 2:59am UTC
can u try to use like beginner functions he says we cant do float yet is there a way to do it with just the functions and variables i have now
Oct 2, 2012 at 9:35pm UTC
You can change ALL the float types to int.