diff --git a/main.cpp b/main.cpp index a495fc9..907e7e0 100644 --- a/main.cpp +++ b/main.cpp @@ -7,15 +7,23 @@ int main() std::cout << "Hi, please enter two whole numbers: "; 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; + + if (x * y != 0) + { + std::cout << x << "+" << y << "=" << x + y << std::endl; + std::cout << x << "-" << y << "=" << x - y << std::endl; + std::cout << x << "*" << y << "=" << x * y << std::endl; + std::cout << x << "/" << y << "=" << x / y << " with remainder of " << x % y << std::endl; + std::cout << "Square root of " << x << " is " << sqrt(x) << std::endl; + std::cout << "Square root of " << y << " is " << sqrt(y) << std::endl; + std::cout << x << "^" << y << "=" << pow(x,y) << std::endl; + + } else + { + std::cout << "Please enter non-zero numbers!" << std::endl; + } return 0; -} +} \ No newline at end of file