From 096b73d5de4319740348650366157b6a49791db3 Mon Sep 17 00:00:00 2001 From: ElianRamirez Date: Mon, 8 Sep 2025 11:26:57 -0700 Subject: [PATCH] handles NaN errors closes #61 --- main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 958ba61..41a9ecb 100644 --- a/main.cpp +++ b/main.cpp @@ -15,7 +15,11 @@ int main() cout << "Addition: " << x + y << endl; cout << "Subtraction: " << x - y << endl; cout << "Multiplication: " << x * y << endl; - cout << "Division: " << x / y << endl; + if (y == 0) { + cout << "Division 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;