From 5f2467dc269bdda9f84cfd9926e5c798f8049810 Mon Sep 17 00:00:00 2001 From: Acsimon112 Date: Mon, 8 Sep 2025 11:26:58 -0700 Subject: [PATCH 1/2] added a case to check for undefined division, closes #61 --- main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 958ba61..3c97439 100644 --- a/main.cpp +++ b/main.cpp @@ -15,8 +15,12 @@ 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 2514b838efd3161bbedf2cde01362691ee7dfaa7 Mon Sep 17 00:00:00 2001 From: Acsimon112 Date: Wed, 10 Sep 2025 11:40:38 -0700 Subject: [PATCH 2/2] Merge conflict resolved. --- main.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/main.cpp b/main.cpp index 3c97439..82a4be9 100644 --- a/main.cpp +++ b/main.cpp @@ -1,28 +1,25 @@ #include #include -using std::cin; -using std::cout; -using std::endl; - int main() { - 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::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; + std::cout << "Dividing by zero is not a number." << std::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; }