diff options
author | Oskar <[email protected]> | 2024-08-29 13:27:45 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-29 13:27:45 +0200 |
commit | 743c47c671347a0ac0f8f64b7117b48c65bab073 (patch) | |
tree | 5e33efe7a3e4d6ba5a9a6ee34762e978b51cb6b3 /5p5.cpp | |
parent | 1208defdbc457a89c0d9aea3b8faf86b8492761f (diff) |
more
Diffstat (limited to '5p5.cpp')
-rw-r--r-- | 5p5.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -0,0 +1,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; +} |