can't get my program to work, help please
Ok I want a program to do basic calculator functions (mainly to show off to my friends), but I keep f*ing up the program. Here is what I have so far.
#include <iostream>
using namespace std;
int main()
{
int answer;
char function;
int a;
int b;
int c;
int d;
cout<<"***Please enter first number in equation.";
cin>> a;
cin.ignore();
cout<<"Please enter second number.";
cin>> b;
cin.ignore();
cout<<"Please enter a function.";
cin>> function;
cin>> a == *
cin>> b == -
cin>> c == +
cin>> d == /
if ( function == a ) {
cout<< a-b;
}
else if ( function == b ) {
cout<< a+b;
}
else if ( function == c ) {
cout<< a*b;
}
else if ( function == d ) {
cout<< a/b;
}
}
Any suggestions would be great.
I will make C++ my bitch.
|