From 0248b0f3604e8fad8c9743d4da2ecc40e72f5161 Mon Sep 17 00:00:00 2001 From: Cole Doud Date: Mon, 8 Sep 2025 12:05:24 -0700 Subject: [PATCH 1/2] Clarified math input, closes #62 --- main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 958ba61..bbdca2a 100644 --- a/main.cpp +++ b/main.cpp @@ -12,13 +12,13 @@ int main() int x,y; cin >> x >> y; - cout << "Addition: " << x + y << endl; - cout << "Subtraction: " << x - y << endl; - cout << "Multiplication: " << x * y << endl; - cout << "Division: " << x / y << endl; - cout << "Remainder: " << x % y << endl; - cout << "Square Root: " << sqrt(x) << endl; - cout << "Square: " << pow(x, y) << endl; + cout << x << "+" << y << "=" << x + y << endl; + cout << x << "-" << y << "=" << x - y << endl; + cout << x << "*" << y << "=" << x * y << endl; + cout << x << "/" << y << "=" << x / y << " with remainder of " << x % y << endl; + cout << "Square root of " << x << " is " << sqrt(x) << endl; + cout << "Square root of " << y << " is " << sqrt(y) << endl; + cout << x << "^" << y << "=" << pow(x,y) << endl; return 0; -} +} \ No newline at end of file From 757c07b5e68ddb6f98a4f607e54849a5651a2057 Mon Sep 17 00:00:00 2001 From: Cole Doud Date: Wed, 10 Sep 2025 11:46:33 -0700 Subject: [PATCH 2/2] fixes divide by zero issue, closes #61 --- main.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index bbdca2a..87d24b8 100644 --- a/main.cpp +++ b/main.cpp @@ -10,15 +10,23 @@ int main() cout << "Hi, please enter two whole numbers: "; int x,y; - + cin >> x >> y; - cout << x << "+" << y << "=" << x + y << endl; - cout << x << "-" << y << "=" << x - y << endl; - cout << x << "*" << y << "=" << x * y << endl; - cout << x << "/" << y << "=" << x / y << " with remainder of " << x % y << endl; - cout << "Square root of " << x << " is " << sqrt(x) << endl; - cout << "Square root of " << y << " is " << sqrt(y) << endl; - cout << x << "^" << y << "=" << pow(x,y) << endl; + + if (x * y != 0) + { + cout << x << "+" << y << "=" << x + y << endl; + cout << x << "-" << y << "=" << x - y << endl; + cout << x << "*" << y << "=" << x * y << endl; + cout << x << "/" << y << "=" << x / y << " with remainder of " << x % y << endl; + cout << "Square root of " << x << " is " << sqrt(x) << endl; + cout << "Square root of " << y << " is " << sqrt(y) << endl; + cout << x << "^" << y << "=" << pow(x,y) << endl; + + } else + { + cout << "Please enter non-zero numbers!" << endl; + } return 0; } \ No newline at end of file