diff --git a/main.cpp b/main.cpp index a495fc94..3c4c67a1 100644 --- a/main.cpp +++ b/main.cpp @@ -3,19 +3,26 @@ int main() { - std::cout << "THE FIRST EXAMPLE MATH DISPLAY!\n"; - std::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; + 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; - std::cout << "Square Root: " << sqrt(x) << std::endl; - std::cout << "Square: " << pow(x, y) << std::endl; + std::cin >> x >> y; + std::cout << "Addition: " << x + y << endl; + std::cout << "Subtraction: " << x - y << endl; + std::cout << "Multiplication: " << x * y << endl; + if(y != 0) + { + std::cout << "Division: " << x / y << endl; + std::cout << "Remainder: " << x % y << endl; + } + else + { + std::cout << "Dividing by zero is not a number." << endl; + } + std::cout << "Square Root: " << sqrt(x) << endl; + std::cout << "Square: " << pow(x, y) << endl; - return 0; + return 0; }