summaryrefslogtreecommitdiff
path: root/5p6.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-08-29 13:27:45 +0200
committerOskar <[email protected]>2024-08-29 13:27:45 +0200
commit743c47c671347a0ac0f8f64b7117b48c65bab073 (patch)
tree5e33efe7a3e4d6ba5a9a6ee34762e978b51cb6b3 /5p6.cpp
parent1208defdbc457a89c0d9aea3b8faf86b8492761f (diff)
more
Diffstat (limited to '5p6.cpp')
-rw-r--r--5p6.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/5p6.cpp b/5p6.cpp
new file mode 100644
index 0000000..3681085
--- /dev/null
+++ b/5p6.cpp
@@ -0,0 +1,24 @@
+#include <iostream>
+#include <vector>
+
+/*
+ *
+ * 5.6
+ *
+ * I had no idea we were only making the simple
+ * version of this program in the previous exercise
+ */
+
+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; }
+
+ (TestScore < 60) ? FinalGrade = GradeLetters[0] : FinalGrade = GradeLetters[(TestScore - 50) / 10];
+ std::cout << "Your grade is: " << FinalGrade << std::endl;
+ return 0;
+}