anonymous
2011-05-19 06:52:38 UTC
#include
using namespace std;
int addition (int a,int b)
{
int c;
c = a + b;
return c;
}
int subtraction (int d,int e)
{
int f;
f = d - e;
return f;
}
int multiplication (int g,int h)
{
int i;
i = g * h;
return i;
}
int division (int j,int k)
{
int l;
l = j / k;
return l;
}
int main()
{
int m;
cout << "Welcome to Calculator!";
cout << "Would you like to use addition, subtraction, multiplication, or division?";
cin >> m;
if (m=="addition")
{
int n;
int o;
cout << "Multiply this number: ";
cin >> n;
cout << "By this number: ";
cin >> o;
cout << "The answer is: ";
cout << n * o;
}
}
It gives me this error:
error: ISO C++ forbids comparison between pointer and integer.
Does this mean that I cannot refer to the input that I recieved with an "if" statement?
I do realize that I can use lots of other methods, but I prefer to do "if" statements at the moment due to the fact that I just started.