wont work):

#include <iostream>
#include <string>
#include <Windows.h>
#include <cmath>
using namespace std;

int main()
{
std::string input;
cout << "Choose arithmetic: Addition or Subtraction or Multiply or Divison " << endl;
cin >> input;

{
int first;
cout << "Enter the first number: " ;
cin >> first ;

int second;
cout << "Enter the second number: " ;
cin >> second ;

int sum = first + second;
cout << "The sum of these numbers is: " << sum << '\n' ;
Sleep(20000);
}

if(input == "Subtraction")
{
int first;
cout << "Enter the first number: " ;
cin >> first ;

int second;
cout << "Enter the second number: " ;
cin >> second ;

int diff = first - second;
cout << "The difference of these numbers is: " << diff << '\n' ;
Sleep(20000);

}
if(input=="Multipy")
{
int first;
cout << "Enter the first number: " ;
cin >> first;

int second;
cout << "Enter the second number: ";
cin >> second;

int diff = first * second;
cout << "The difference of these numbers is: " << diff << '\n' ;
Sleep(200000);
}

if(input=="Divison")
{
int first;
cout << "Enter the first number: " ;
cin >> first;

int second;
cout << "Enter the second number: ";
cin >> second;

int d = first / second;
cout << "The difference of these numbers is: " << d << endl;
Sleep(20000);
}
}
What do you mean?
ehh... i'm not gonna read that, please choose the source code format.
closed account (jwkNwA7f)

I don't see any problems right off, except
Since you have already done: `using namespace std;` , then this line:
`std::string input;`
should be:
`string input;`
I would modify this part
 ``123`` ``````std::string input; cout << "Choose arithmetic: Addition or Subtraction or Multiply or Divison " << endl; cin >> input;``````

by this other
 ``123`` ``````string input; cout << "Choose arithmetic: Addition or Subtraction or Multiply or Divison " << endl; getline(cin, input);``````

as you use it, erase
`#include<cmath> `
Last edited on
Topic archived. No new replies allowed.