1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <iostream>
using namespace std;
int main()
{
int a,b,c,pl,su,di,mu,sum;
cout << "2 Numbers calculator" << endl << endl;
cout << "Insert first number" << endl;
cin >> a;
cout << "Insert second number" << endl;
cin >> b;
cout << "What do you want to do with the numbers (+,-,x,:)"; //(user inserts sign +,-,x,:)
cin >> c; // +, -,x,: holder
pl = a+b; // Plius adds values
su = a-b; // Minus subtracts values
mu = a*b; // Multiples Values
di = a/b; // Divide Values
if (c = "+"){
cout << pl << endl;
}else if (c = "-"){
cout << su << endl;
}else if (c = "x"){
cout << mu << endl;
}else (c = ":"){
cout << di << endl;
}
return 0;
}
|