Calculator
Todo:
Modify the below code to have the following functionalities:
- Add Modulo, x power y functionality
- Square root, log functionality
Calculator.cpp
#include <iostream>
using namespace std;
int main()
{
while(true) {
int operation;
cout<<"Welcome to your own Personal Calculator"<<endl<<endl;
cout<<"Please enter the selection among 1, 2, 3, 4 "<<endl;
cout<<"1. Addition "<<endl;
cout<<"2. Subtraction "<<endl;
cout<<"3. Multiplication "<<endl;
cout<<"4. Division "<<endl<<endl;
cout<<"Enter your Selection: ";
cin>>operation;
cout<<"You have selected: "<<operation<<endl;
int num1, num2;
cout<<"Enter First Number: ";
cin>>num1;
cout<<"Enter Second Number: ";
cin>>num2;
if(operation == 1) {
cout<<"After addition: "<<num1+num2;
} else if (operation == 2) {
cout<<"After subtraction: "<<num1-num2;
} else if (operation == 3) {
cout<<"After multiplication: "<<num1*num2;
} else if (operation == 4) {
cout<<"After division: "<<num1/num2;
}
cout<<endl;
}
return 0;
}