diff options
| author | WiserJ <[email protected]> | 2021-10-27 14:55:44 -0700 |
|---|---|---|
| committer | WiserJ <[email protected]> | 2021-10-27 14:55:44 -0700 |
| commit | 8243e65f84ae398d981ad6aefad126761af0d34f (patch) | |
| tree | 9e576bc36a0ff67e371dea22c5e17df325ce97e8 | |
| parent | Add online IDE url (diff) | |
| download | cst116-lab5-jeffwoit-8243e65f84ae398d981ad6aefad126761af0d34f.tar.xz cst116-lab5-jeffwoit-8243e65f84ae398d981ad6aefad126761af0d34f.zip | |
working 2/4
| -rw-r--r-- | CST116F2021-Lab5/CST116F2021-Lab5.cpp | 47 |
1 files 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 <iostream> +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 |