From 0d78576f05dee4a0f87bdd450d920601d7677870 Mon Sep 17 00:00:00 2001 From: Dalton Underwood Date: Mon, 31 Aug 2026 12:07:42 -0700 Subject: [PATCH 1/2] fixed divide by zero --- main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) mode change 100644 => 100755 main.cpp diff --git a/main.cpp b/main.cpp old mode 100644 new mode 100755 index 5411e7a3..e3f9a198 --- a/main.cpp +++ b/main.cpp @@ -16,8 +16,14 @@ int main() 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; + if (y == 0){ + cout << "Dividing by zero is not a number" << endl; + } + else{ + cout << "Division: " << x / y << endl; + cout << "Remainder: " << x % y << endl; + + } cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(x, y) << endl; From 2061a1de983ce887229f2c079885123d174b95ee Mon Sep 17 00:00:00 2001 From: Dalton Underwood Date: Wed, 2 Sep 2026 11:59:57 -0700 Subject: [PATCH 2/2] fixed conflict with upstream --- main.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/main.cpp b/main.cpp index e3f9a198..b5371043 100755 --- a/main.cpp +++ b/main.cpp @@ -1,31 +1,26 @@ #include #include -using std::endl; -using std::cin; -using std::cout; - int main() { - cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; - cout << "Hi, please enter two whole numbers: "; + std::cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; + std::cout << "Hi, please enter two whole numbers: "; int x,y; - cin >> x >> y; - cout << "Addition: " << x + y << endl; - cout << "Subtraction: " << x - y << endl; - cout << "Multiplication: " << x * y << endl; + std::cin >> x >> y; + std::cout << "Addition: " << x + y << std::endl; + std::cout << "Subtraction: " << x - y << std::endl; + std::cout << "Multiplication: " << x * y << std::endl; if (y == 0){ cout << "Dividing by zero is not a number" << endl; } else{ - cout << "Division: " << x / y << endl; - cout << "Remainder: " << x % y << endl; - + std::cout << "Division: " << x / y << std::endl; + std::cout << "Remainder: " << x % y << std::endl; } - cout << "Square Root: " << sqrt(x) << endl; - cout << "Square: " << pow(x, y) << endl; + std::cout << "Square Root: " << sqrt(x) << std::endl; + std::cout << "Square: " << pow(x, y) << std::endl; return 0; }