From 61fb159a5c6aaa79c1dde3babed3e3a0028a2d1a Mon Sep 17 00:00:00 2001 From: jrbaartman Date: Mon, 8 Sep 2025 11:29:53 -0700 Subject: [PATCH] now handles NaN, closes #62 --- main.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 958ba61..9a821ad 100644 --- a/main.cpp +++ b/main.cpp @@ -15,8 +15,19 @@ 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; + } + + if(y == 0) { + cout << "Dividing by zero is not a number." << endl; + } else { + cout << "Remainder: " << x % y << endl; + } + cout << "Square Root: " << sqrt(x) << endl; cout << "Square: " << pow(x, y) << endl;