diff options
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; +} |