From 04e152e03b87f48781effd4654cdb1a390296862 Mon Sep 17 00:00:00 2001 From: zigglethorp Date: Wed, 28 Jan 2026 11:43:17 -0800 Subject: [PATCH 1/3] prevents devide by zero and updated to int32_t. Resolves 67 and 340 --- main.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 5411e7a..6c2e0ba 100644 --- a/main.cpp +++ b/main.cpp @@ -1,17 +1,22 @@ #include #include +<<<<<<< HEAD using std::endl; using std::cin; using std::cout; int main() +======= +int32_t main() +>>>>>>> 260d733 (prevents devide by zero and updated to int32_t. Resolves 67 and 340) { cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; cout << "Hi, please enter two whole numbers: "; - int x,y; + int32_t x,y; +<<<<<<< HEAD cin >> x >> y; cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; @@ -20,6 +25,21 @@ int main() cout << "Remainder: " << x % y << endl; cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(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) { + std::cout << "Deviding by zero is not a number. \n"; + } else{ + std::cout << "Division: " << x / y << std::endl; + } + std::cout << "Remainder: " << x % y << std::endl; + std::cout << "Square Root: " << sqrt(x) << std::endl; + std::cout << "Square: " << pow(x, y) << std::endl; +>>>>>>> 260d733 (prevents devide by zero and updated to int32_t. Resolves 67 and 340) return 0; } From 3ce60f1de441dbc0ca78278af376fb71d8f2ce7b Mon Sep 17 00:00:00 2001 From: zigglethorp Date: Mon, 2 Feb 2026 11:15:52 -0800 Subject: [PATCH 2/3] Updated int datatype to int32_t --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 6c2e0ba..ccc4aaf 100644 --- a/main.cpp +++ b/main.cpp @@ -32,7 +32,7 @@ int32_t main() std::cout << "Multiplication: " << x * y << std::endl; if (y == 0) { - std::cout << "Deviding by zero is not a number. \n"; + std::cout << "Deviding by zero is not a number.\n"; } else{ std::cout << "Division: " << x / y << std::endl; } From f8290532e872386e0657ffbdf9e30751c9341e1e Mon Sep 17 00:00:00 2001 From: zigglethorp Date: Mon, 2 Feb 2026 11:36:54 -0800 Subject: [PATCH 3/3] Replaced std:: in code with using namespece std. resolves #341 --- main.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/main.cpp b/main.cpp index ccc4aaf..96ba3f1 100644 --- a/main.cpp +++ b/main.cpp @@ -1,22 +1,19 @@ #include #include -<<<<<<< HEAD using std::endl; using std::cin; using std::cout; int main() -======= + int32_t main() ->>>>>>> 260d733 (prevents devide by zero and updated to int32_t. Resolves 67 and 340) { cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; cout << "Hi, please enter two whole numbers: "; int32_t x,y; -<<<<<<< HEAD cin >> x >> y; cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; @@ -25,21 +22,6 @@ int32_t main() cout << "Remainder: " << x % y << endl; cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(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) { - std::cout << "Deviding by zero is not a number.\n"; - } else{ - std::cout << "Division: " << x / y << std::endl; - } - std::cout << "Remainder: " << x % y << std::endl; - std::cout << "Square Root: " << sqrt(x) << std::endl; - std::cout << "Square: " << pow(x, y) << std::endl; ->>>>>>> 260d733 (prevents devide by zero and updated to int32_t. Resolves 67 and 340) return 0; }