You are using a version without Ads of this website. Please, consider donating:

### help me quick please new to c++

code is at bottom

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

(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:

i will get a 100: do the 85 except:

Code:

#include <iostream>
using namespace std;
void output(double avg1, char lg)
{
}
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;
s=s+numg;
}
while (counter<numg);
}
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(){
double average;
double sum;
return 0;
}
Hey, this code should work for averaging 3 numbers and displaying a corresponding grade. However, there are bugs, and I only had so much time to work on because I have my own homework. It can be made much shorter, and is not efficient at all, but for your purposes, it should help.

I advise you to go thought and check to make sure anything that I missed, I did miss ALOT.

Heres the code:

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657`` ``````#include #include using namespace std; float grade (float a) { if (a>=93) return ('A'); if ((a<93)&&(a>=85)) return ('B'); if ((a<85)&&(a>=73)) return ('C'); if ((a<77)&&(a>=70)) return ('D'); if (a < 70) return ('F'); } int input () { float gradesum = 0; float input = 0; for (int counter = 0; counter <= 3; counter++) { //startloop if (counter = 1) { cout<<"Enter first grade:\n"; cin>>input; } if (counter = 2) { cout<<"Enter second grade:\n"; cin>>input; input = input + input; } if (counter = 3) { cout << "Enter final grade:\n"; cin>>input; input = input + input; system ("cls"); } gradesum = gradesum +input; //endloop } return (gradesum); } int main () { char finalgrade; float average; average = input (); finalgrade = grade (average); system ("cls"); cout << "Your Average is "<

Sorry for the stall:(
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
You can change ALL the float types to int.
Topic archived. No new replies allowed.