diff options
| author | rPatrickWarner <[email protected]> | 2024-01-13 13:40:07 -0800 |
|---|---|---|
| committer | rPatrickWarner <[email protected]> | 2024-01-13 13:40:07 -0800 |
| commit | 560678c6803e9dcd8346c1c5e1d41591c80568bc (patch) | |
| tree | e92404b93afe96470177e605b840bf37ef914ae4 /Inclassexercise4 | |
| parent | init (diff) | |
| download | in-class-exercise-4-reecepwarner-main.tar.xz in-class-exercise-4-reecepwarner-main.zip | |
Diffstat (limited to 'Inclassexercise4')
| -rw-r--r-- | Inclassexercise4/Inclassexercise4/Source.cpp | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/Inclassexercise4/Inclassexercise4/Source.cpp b/Inclassexercise4/Inclassexercise4/Source.cpp index b2801ed..e405fb8 100644 --- a/Inclassexercise4/Inclassexercise4/Source.cpp +++ b/Inclassexercise4/Inclassexercise4/Source.cpp @@ -7,12 +7,45 @@ using std::cout; using std::cin; using std::endl; -main() { - - - - - - - return 0 -}
\ No newline at end of file +int main() +{ + cout << "Please input a number:" << endl; + + + int i = 0; + + cin >> i; + + + switch (i) + { + case 100: + + cout << "Have a great day" << endl; + break; + case 5: + cout << "You picked" << i << endl; + case 21: + int j; + int k; + cout << "Input first number"; + cin >> j; + cout << "Input another number"; + cin >> k; + if (k == 0) + { + cout << "Cannot divide by zero" << endl; + break; + } + int g; + g = j % k; + cout << "The remainder of" << j << "divided by" << k << "is" << g << endl; + + default: + cout << "Bad input, no switches to switch"; + break; + } + + + return 0; +} |