From db032a9adbaba927a5250957370336101d2ea8d2 Mon Sep 17 00:00:00 2001 From: Nathan Whitney <86084524+the29ster@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:18:32 -0800 Subject: [PATCH] Create main.cpp --- main.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..a52bb1a --- /dev/null +++ b/main.cpp @@ -0,0 +1,29 @@ +#include +#include + +int main() +{ + cout<<"Hi, please enter two whole numbers: "; + + int x,y; + + std::cin >> x >> y; + std::cout << x << "+" << y << "=" << x + y << std::endl; + std::cout << x << "-" << y << "=" << x - y << std::endl; + std::cout << x << "*" << y << "=" << x * y << std::endl; + + if(y == 0) + { + std::cout << "Dividing by zero is not a number." << std::endl; + } + else + { + 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; + + return 0; +}