+ 1
How to do random action with numbers?
Hello friends, nice to read you. How to do this? (it's work like string, but how to make the equation?) https://code.sololearn.com/WmsdTkZ9i95E/?ref=app
2 Antworten
+ 3
the +-×÷ you set is characters, cannot directly use for math operators. Use switch operator to help you choose the correct math operation.
+ 2
Use if..else to evaluate which random operator string returned, then do the math as necessary, depending on the operator returned.
if(action==="+")
// add a & b
...