| rohanshah1 (16) | |
|
well i have an assignment which says i have to let the user enter number1 (+,-,*,/) number2 then i have to print the number statement and show answer example 2.1 * 3.5 is there a way i can define the + * / - operators or what do i do because i got no clue =x | |
|
|
|
| L B (3327) | |
| Yes, you can overload those operators, but that's not what you need to do here at all. Basically, you get them to enter number1, then an operator (store it in a char), and then number2. Then just use a switch statement or if statements to do the right thing based on what operator they put in. | |
|
|
|
| rohanshah1 (16) | |
|
yea i figured it out =x but it seems i still did something wrong lol can u see whats wrong because only thing that happens when i input the data is nothing lol it just ends | |
|
Last edited on
|
|