Hi, my name is Justin and I'm new to C++ and this forum. I have been following TheNewBoston's tutorial about C++. He showed me how to make a simple calculator. It was very easy to make and it worked fine, but now I'm trying to add something to it. I'm trying to that the user can tell the computer to +, - or * the sum. But it doesn't work for some reason. Here is my code.
Sorry if my English grammar is bad...
#include <iostream>
usingnamespace std;
int main ()
{
int a;
int b;
int c;
int som;
cout << "Typ een nummer in\n";
cin >> a;
c = +, - , *;
cout << "Wil je het met iets vermenigvuldigen (*), aftrekken (-) of optellen (+)? typ +, - of *";
cin >> c;
cout << "Typ nog een nummer in\n";
cin >> b;
som = a c b;
return 0;
}
int c;c = +, - , *;
What kind of integer is +,-,* ? And what are you trying to do by making c equal to these things? The very next thing you do is put something else in it anyway - cin >> c;
The comma operator , does not do what you think it does. Don't use it.
som = a c b;
What do you think a c b will do? It's just wrong.