#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main ()
{
//first number
shortint a;
// operation
shortint b;
//second number
shortint c;
cout << "Select your first number";
cin >> a;
cout << "Select the operation";
cout << "1= add, 2= sub, 3= multiply, 4= divide;
cin >> b;
cout << "Select the second number";
cin >> c;
if b= 1 cout << " Your Result is" << a + c;
if b= 2 cout << " Your Result is" << a - c;
if b= 3 cout << " Your Result is" << a * c;
if b= 4 cout << " Your Result is" << a / c;
cin.ignore(LONG_MAX,'\n');
cin.get ();
return 0;
}
#include <iostream>
usingnamespace std;
int main ()
{
//first number
shortint a;
// operation
shortint b;
//second number
shortint c;
cout << "Select your first number ";
cin >> a;
cout << "Select the operation ";
cout << "1= add, 2= sub, 3= multiply, 4= divide";
cin >> b;
cout << "Select the second number ";
cin >> c;
if (b== 1) cout << " Your Result is " << a + c;
if (b== 2) cout << " Your Result is " << a - c;
if (b== 3) cout << " Your Result is " << a * c;
if (b== 4) cout << " Your Result is " << a / c;
cin.ignore(LONG_MAX,'\n');
cin.get ();
return 0;
}
Your Mistakes:
1) = is not same as ==
2) put the condition of if in parenthesis