Student Average Grade.

Why isn't my average coming out?
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

int main()

{

string ssnumber;
int exam1 = 0, exam2 = 0, exam3 = 0, final = 0,count = 0, sum = 0;
int average1 = 0, average2 = 0, average3 = 0;
double averagegrade, classaverage;



while (count < 3)

{

cout <<"SS Number";

cin >>ssnumber;

cout <<"Exam 1";

cin >>exam1;

cout <<"Exam 2";

cin >>exam2;

cout <<"Exam 3";

cin >>exam3;

cout <<"Final";

cin >>final;

cout <<"Average";

cin >>averagegrade;


cout<<"Class average is:";

cin >>classaverage;


averagegrade = (exam1 + exam2+ exam3 + final * 2) / 5;

classaverage = (average1 + average2 + average3) / 3;

count++;


cout<<setw(6)<<ssnumber<<setw(19)<<exa…
<<exam3<<setw(6)<<final<<setw(6)<<aver…
<<average3<<setw(6)<<averagegrade<<set…


}


return 0;

}
Are you intentionally doubling a student's final grade? That will make the actual average be higher than you expect.

Also, the classaverage line specifically sets classaverage to 0/3, which equals 0, every time you go through the loop.
You're right. Thank you very much for your help!
Topic archived. No new replies allowed.