Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string i;
- string newString ="Commands: \n ;calculator \n What would you like me to do, sir?: ";
- cout<<newString;
- cin>>i;
- if (i == ";calculator"){
- int a,b;
- newString = "\n Multiplication \n Division \n Addition \n Subtraction";
- cout<<newString;
- newString = "\n Choose one: ";
- cout<<newString;
- cin>>i;
- if (i == "Multiplication") {
- newString = "Insert first number here: ";
- cout<<newString;
- cin>>i;
- a = stoi(i);
- newString = "Insert second number here: ";
- cout<<newString;
- cin>>i;
- b=stoi(i);
- cout<<a*b;
- }
- else{
- if (i == "Division") {
- newString = "Insert dividend here: ";
- cout<<newString;
- cin>>i;
- a = stoi(i);
- newString = "Insert divisor here: ";
- cout<<newString;
- cin>>i;
- b=stoi(i);
- cout<<a/b;
- }
- else{
- if (i == "Subtraction") {
- newString = "Insert first number here: ";
- cout<<newString;
- cin>>i;
- a = stoi(i);
- newString = "Insert second number here: ";
- cout<<newString;
- cin>>i;
- b=stoi(i);
- cout<<a-b;
- }
- else{
- if (i == "Addition") {
- newString = "Insert first number here: ";
- cout<<newString;
- cin>>i;
- a = stoi(i);
- newString = "Insert second number here: ";
- cout<<newString;
- cin>>i;
- b=stoi(i);
- cout<<a+b;
- }
- }
- }
- }
- }
- else{
- cout<<"Not a command!";
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement