Doubt in solving Basic calculator

rest of the code is working,
but don’t know how to seek input again in case of invalid operation entered.

Hi @shubham.mehla2000
Put your code in a do-while loop and check if the entered character ch == ‘x’ or ch == ‘X’ . If it is , terminate the program. Make this the condition for your while loop. Make sure not to print “Invalid operation” if ‘x’ is entered. You need to modify your switch case to do nothing in case of ‘x’ and ‘X’.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like