-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExer05_05.cpp
39 lines (39 loc) · 905 Bytes
/
Exer05_05.cpp
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
#include <iostream>
#include <string>
#include <vector>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::vector;
int main()
{
int grade;
const vector<string> scores = {"F", "D", "C", "B", "A", "A++"};
string lettergrade;
while(cin >> grade)
{
if(grade <= 100 && grade >= 0)
{
if(grade < 60)
{
lettergrade = scores[0];
}
else
{
lettergrade = scores[(grade - 50) / 10];
if(grade != 100)
{
if(grade % 10 > 7)
lettergrade += '+';
else if(grade % 10 < 3)
lettergrade += '-';
else
;
}
}
cout << lettergrade << endl;
}
}
return 0;
}