From 8243e65f84ae398d981ad6aefad126761af0d34f Mon Sep 17 00:00:00 2001 From: WiserJ Date: Wed, 27 Oct 2021 14:55:44 -0700 Subject: working 2/4 --- CST116F2021-Lab5/CST116F2021-Lab5.cpp | 47 +++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/CST116F2021-Lab5/CST116F2021-Lab5.cpp b/CST116F2021-Lab5/CST116F2021-Lab5.cpp index e7591f7..c13da24 100644 --- a/CST116F2021-Lab5/CST116F2021-Lab5.cpp +++ b/CST116F2021-Lab5/CST116F2021-Lab5.cpp @@ -3,18 +3,39 @@ #include +using namespace std; + +const int NUM_SCORES = 10; +const int NUM_STUD = 5; + int main() { - std::cout << "Hello World!\n"; -} - -// Run program: Ctrl + F5 or Debug > Start Without Debugging menu -// Debug program: F5 or Debug > Start Debugging menu - -// Tips for Getting Started: -// 1. Use the Solution Explorer window to add/manage files -// 2. Use the Team Explorer window to connect to source control -// 3. Use the Output window to see build output and other messages -// 4. Use the Error List window to view errors -// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project -// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file + float currStudent[NUM_SCORES]{ 0.0 }; + + + for (int i = 0; i < NUM_SCORES; i++) + { + cout << "Enter score #" << i + 1 << " of " << NUM_SCORES << ": "; + cin >> currStudent[i]; + } + + char Grade[NUM_SCORES]; + + for (int i = 0; i < NUM_SCORES; i++) + { + if (currStudent[i] >= 92.0) + Grade[i] = 'A'; + else if (currStudent[i] >= 84.0) + Grade[i] = 'B'; + else if (currStudent[i] >= 75.0) + Grade[i] = 'C'; + else if (currStudent[i] >= 65.0) + Grade[i] = 'D'; + else + Grade[i] = 'F'; + + cout << "\nTest #" << i + 1 << " received grade " << Grade[i]; + + } + +} \ No newline at end of file -- cgit v1.2.3