Im learning C++ and I have a assigment to create small calculator using if,else if statements.The program should work like this.First you need to choose the operation like add or substract then enter first argument and then second argument and get a result.I write the code but it doesnt show the address right.The answers shows different result from what I expected.The multiple and divide give me the right result but add and substract wrong. Please help.
#include<iostream>
using namespace std;
int main()
{
int a = 1, b = 2, c = 3, d = 4;
int first_argument, second_argument;
cout << "Please choose the number: " <<endl<< "1.Multiple"<<endl<<"2.Divide" <<endl<<"3.Substract"<<endl<<"4.Add" << "\n";
cin >> a,b,c,d;
cout << "Please choose the first argument" << "\n";
cin >> first_argument;
cout << "Please choose the second argument" << "\n";
cin>>second_argument;
if (a==1)
cout <<"The answer is "<<first_argument*second_argument<< "\n";
else if (b == 2)
cout << "The answer is " << first_argument / second_argument << "\n";
else if (c == 3)
cout << "The answer is " << first_argument - second_argument << "\n";
else if (d == 4)
cout << "The answer is " << first_argument + second_argument << "\n";
cin.ignore();
cin.get();
return 0;
}