Please HELP! Simple Grade Average

I've written what I feel like should be accurate code, but I keep getting errors :/ Any help would be greatly appreciated. I'm getting an error message on the first cout and the first if statement under studAvg. Thank you in advance!

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
#include <iostream>
#include <string>

using namespace std;

int main()
{
 string studFirstName, studLastName;
 int studExam1, studExam2, studExam3, studScore, studAvg;
 char grade;

 cout <<"Enter Student first name: ";
 cin>> studFirstName;
 cout <<"Enter student last name: ";
 cin>> studLastName;
 cout <<"Enter score for exam 1: ";
 cin>> studExam1;
 cout <<"Enter score for exam 2: "; 
 cin>> studExam2;
 cout <<"Enter score for exam 3: "; 
 cin>> studExam3;

 studScore = studExam1 + studExam2 + studExam3;
 studAvg = studScore / 3 ;

 cout <<"Student's Final Grade: " << studAvg << endl;

 if studAvg >= 90 then
 grade = 'A'
 else if studAvg >=80 then
 grade = 'B'
 else if studAvg >=70 then
 grade = 'C'
 else if studAvg >=60 then
 grade = 'D'
 else 
 grade = 'F'
 endif
 
 cout <<"Grade: " << grade << endl; 

 system ("pause");

 return 0;
}
Last edited on
Line 10 you are missing a semicolon.

Your if statement syntax is wrong. Please review:
http://www.cplusplus.com/doc/tutorial/control/#if
Thank you! can't believe I didn't see that. However, I just added the semicolon to my code and it still won't build. Anything else wrong with it?
Did you fix the if statement syntax?
Topic archived. No new replies allowed.