Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"iostream": "cpp"
}
}
40 changes: 32 additions & 8 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,43 @@

int main()
{
std::cout << "THE FIRST EXAMPLE MATH DISPLAY!\n";
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;

//cout << "Addition: " << x + y << endl;
std::cout << x << "+" << y << "=" << x + y << std::endl;

//cout << "Subtraction: " << x - y << endl;
std::cout << x << "-" << y << "=" << x - y << std::endl;

//cout << "Multiplication: " << x * y << endl;
std::cout << x << "*" << y << "=" << x * y << std::endl;

//cout << "Division: " << x / y << endl;
//cout << "Remainder: " << x % y << endl;

if (y == 0) {
std::cout << "Dividing by zero is not a number." << std::endl;
}
else {
std::cout << x << "/" << y << "=" << x / y;
if (x % y > 0) {
std::cout << " with remainder of " << x % y << std::endl;
}
else {
std::cout << std::endl;
}
}

//cout << "Square Root: " << sqrt(x) << endl;
std::cout << "Square root of " << x << " is " << sqrt(x) << std::endl;
std::cout << "Square root of " << y << " is " << sqrt(y) << std::endl;

//cout << "Square: " << pow(x, y) << endl;
std::cout << x << "^" << y << "=" << pow(x,y) << std::endl;

return 0;
}