Could not understand code

i am confused in the input method of question. all inputs are given every time but in code it is taking ch only once in main.

other doubt is in cin>>a>>b as in earlier questions it takes input in same line with a space . but how it is taking in next line input in a and b in this code.

and why we have to use cin in every if statement why we can’t use it once between while and if condition .

Hello @tejuschaturvedi0 in this question cin should be used with every if condition because if the character is not valid then also it will try to take input and according to our input if there is nit valid cahracter then we have to stop there but it will still try to take input and it will then give error also it will disturb the sequence.

can you please tell about which line you are talking?

ok got it just to enter in the while loop we have to take ch once there and after that we will take input for ch in the while loop only as we are doing in the code shared by you.
see line 43.

But we have to take input for every character but we are using cinn in else only . What about when else is not executed then there is no input in if or elseif . So how are they getting input.

@tejuschaturvedi0 no no we are not using cin in else there we have not added any bracket with the else it is running with the line scope only:
check now:

sir i have made the code of the basic calculator but it is showing TLE .

when compiler comes on ; in input it goes for long time and if i remove ; from input it is working fine. sir how can i fix this.

https://ide.codingblocks.com/s/449509 this is the code i am talking about

please share your code i will surely correct .
check now:https://ide.codingblocks.com/s/449776

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.