help me quick please new to c++

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;
}
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:

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
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <windows.h>
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 "<<finalgrade<<endl;
system ("pause");
return 0;
}

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.