From 0a64b64d8acdce7fa06060361b3856c0adb194b1 Mon Sep 17 00:00:00 2001 From: NcollegeB Date: Wed, 10 Sep 2025 11:23:12 -0700 Subject: [PATCH 1/3] fixed Nan --- main.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index a495fc9..720a4c9 100644 --- a/main.cpp +++ b/main.cpp @@ -6,14 +6,24 @@ int main() std::cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; std::cout << "Hi, please enter two whole numbers: "; - int x,y; + int x, y; 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; - std::cout << "Division: " << x / y << std::endl; - std::cout << "Remainder: " << x % y << std::endl; + + if (y == 0) + { + std::cout << "Division: Undefined (division by zero)" << std::endl; + std::cout << "Remainder: Undefined (division by zero)" << std::endl; + } + 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; From 8f5f940e90a5cf72634998a1e55385659e5bcf0b Mon Sep 17 00:00:00 2001 From: NcollegeB Date: Wed, 10 Sep 2025 11:24:56 -0700 Subject: [PATCH 2/3] fixed Nan --- .vscode/settings.json | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9ed8be8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,55 @@ +{ + "files.associations": { + "__bit_reference": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__node_handle": "cpp", + "__split_buffer": "cpp", + "__threading_support": "cpp", + "__verbose_abort": "cpp", + "array": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "complex": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "execution": "cpp", + "memory": "cpp", + "initializer_list": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "locale": "cpp", + "mutex": "cpp", + "new": "cpp", + "optional": "cpp", + "ostream": "cpp", + "print": "cpp", + "queue": "cpp", + "ratio": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "string_view": "cpp", + "tuple": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "variant": "cpp", + "vector": "cpp", + "algorithm": "cpp" + } +} From 3d373751cf9f43d2fbd3bf0c4ca8db1fe1c69350 Mon Sep 17 00:00:00 2001 From: NcollegeB Date: Wed, 10 Sep 2025 11:25:57 -0700 Subject: [PATCH 3/3] yes --- .vscode/settings.json | 55 ------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9ed8be8..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "files.associations": { - "__bit_reference": "cpp", - "__hash_table": "cpp", - "__locale": "cpp", - "__node_handle": "cpp", - "__split_buffer": "cpp", - "__threading_support": "cpp", - "__verbose_abort": "cpp", - "array": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "complex": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "execution": "cpp", - "memory": "cpp", - "initializer_list": "cpp", - "ios": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "locale": "cpp", - "mutex": "cpp", - "new": "cpp", - "optional": "cpp", - "ostream": "cpp", - "print": "cpp", - "queue": "cpp", - "ratio": "cpp", - "sstream": "cpp", - "stack": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "string_view": "cpp", - "tuple": "cpp", - "typeinfo": "cpp", - "unordered_map": "cpp", - "variant": "cpp", - "vector": "cpp", - "algorithm": "cpp" - } -}