0
Operator problem
can anyone can explain why the math operator can't appear like this code: #include <iostream> using namespace std; int main () { int a; int b; int c; int math; cout << "enter the first number" << endl; cin >> a; cout << "enter the second number" << endl; cin >> b; cout << "enter the third number" << endl; cin >> c; cout << "enter the operator" << endl; cin >> math; cout << a << "x " << math << b << " = " << c << endl; return 0; } if you enter the operator like '+' the output is 0 not '+ ' why?please help me.
1 Respuesta
0
math is an int variable, not a char so it is displayed as a number instead of a character