summaryrefslogtreecommitdiff
path: root/5p5.cpp
blob: b4aeff592445fc9451bd9bf6cd7f5ec67d696c29 (plain)
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
#include <iostream>
#include <vector>

/*
 *
 * 5.5
 *
 *
 */

int main () {

	int TestScore = 0;
	std::vector<std::string> GradeLetters = {"F", "D", "C", "B", "A", "A++"};
	std::string FinalGrade;
	if(std::cin >> TestScore) {} else { return -1; }
	
	if(TestScore < 0 || TestScore > 100) { return -1; }

	if(TestScore < 60) {
		FinalGrade = GradeLetters[0];
	} else {
		if(TestScore != 100) {
			FinalGrade = GradeLetters[(TestScore-50) / 10];
			if((TestScore % 10) > 7) {
				FinalGrade += "+";
			} else if((TestScore % 10) < 3) {
				FinalGrade += "-";
			}
		} else {
			FinalGrade = GradeLetters[5];
		}
	}

	std::cout << "Your grade is: " << FinalGrade << std::endl;
	return 0;
}