current position:Home>Enter how an operator is defined and called

Enter how an operator is defined and called

2022-02-04 17:13:37 CSDN Q & A

subject : Enter two operands (exp1,exp2) And an operator (op), Calculation expression exp1 op exp2 Value , among op It can be for +、-、*、/、%5 Any of the symbols .
problem :1. I input op What data type is it ( yes char Do you )
2. In the calculation exp1 op exp2 When , How do I call ( Let the computer recognize op Then use it )

Take the answer :

1. yes char ah
2. You have to judge char What is it , Then call the corresponding function. , use switch

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended