From 790079a0058668591a9dd1a4354074828915a484 Mon Sep 17 00:00:00 2001 From: Arthur Spears Date: Sat, 13 Jan 2024 13:33:45 -0800 Subject: exercise complete --- InClassExercise4/InClassExercise4/Source.cpp | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'InClassExercise4') diff --git a/InClassExercise4/InClassExercise4/Source.cpp b/InClassExercise4/InClassExercise4/Source.cpp index e69de29..6a98448 100644 --- a/InClassExercise4/InClassExercise4/Source.cpp +++ b/InClassExercise4/InClassExercise4/Source.cpp @@ -0,0 +1,53 @@ +// Name: Arthur Spears +// Date: 1/13/24 +// Class: CST 116 +// Assignment: InClass Exercise 4 + +#include + +using std::cout; +using std::cin; +using std::endl; + +int main() +{ + cout << "Please input a number: "; + + int i = 0; + + cin >> i; + + switch(i) + { + case 100: + cout << "You are so amazing" << endl; + break; + case 5: + cout << "You picked " << i << endl; + break; + case 21: + int j; + int k; + cout << "Input first number: "; + cin >> j; + cout << "Input second 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; + break; + + default: + cout << "Bad input, no switches to switch"; + break; + } + + + + return 0; +} \ No newline at end of file -- cgit v1.2.3