forked from pezy/CppPrimer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex5_05.cpp
More file actions
34 lines (29 loc) · 698 Bytes
/
Copy pathex5_05.cpp
File metadata and controls
34 lines (29 loc) · 698 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
#include <iostream>
#include <vector>
#include <string>
using std::vector;
using std::string;
using std::cout;
using std::endl;
using std::cin;
int main()
{
vector<string> scores = {"F", "D", "C", "B", "A", "A++"};
int grade{0};
while (cin >> grade) {
string lettergrade;
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 += "-";
}
}
cout << lettergrade << endl;
}
return 0;
}