-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrade.cpp
More file actions
46 lines (36 loc) · 847 Bytes
/
grade.cpp
File metadata and controls
46 lines (36 loc) · 847 Bytes
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
/*****************************************************
James Bertel
CS111
Lab 3-1
9/25/2017
This program will ask the user for a grade (A, B, C, D OR F) and display a message depending on the grade
*****************************************************/
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
//declare variables
char grade;
bool pass = false;
//inputs
cout << "Enter a grade: ";
cin >> grade;
//outputs
if (grade == 'A' || grade == 'B')
{
cout << "Good job!" << endl;
pass = true;
}
else if (grade == 'C')
{ cout << "OK" << endl;
pass = true;
}
else if (grade == 'D' || grade == 'F')
cout << "Work harder" << endl;
else
cout << "Invalid grade" << endl;
if (pass == true)
cout << "Congratulations! You passed the class. " << endl;
return 0;
}