operating symbols

how to ask the user to input operating symbols like "+","-","*" and then use it to operate on the numbers. The user should be asked to input the symbols not like this
1.+
2.-
3.*
closed account (Dy7SLyTq)
input into a char and run a switch on it. depending on the symbol perform the operation. ie:
[code]
case '+':
lvalue += rvalue;
break;
there are plenty of ways

1) Use ASCII table and get values for algebraic symbols.

2) As DTSCode suggested you can use direct 'char' data type.
Topic archived. No new replies allowed.