Please help me debug this please help me debug this please help me debug this please help me debug this


link for code
please help me debug this please help me debug this please help me debug this please help me debug this please help me debug this
also remove this min word stupidity

Hey @sawarn69,

There multiple issues with your code:

  1. The usage exit(0)
    The function exit(0) is a jump statement of C++. It is used to terminate the program or let the control exit out of the program.

  2. For code will fail for the cases when ch is either ‘x’ or ‘X’.
    Reason:
    After reading the value of ch as ‘x’ it will try to read the values for variables n1 and n2 which is not provided.
    Solution:
    Take inputs for n1 and n2 only if ch is any of +,-,*,/ or %.

  3. You have print the statement: "Invalid operation. Try again. "
    when the ch is other than (+,-,*,/,%,x or X)
    Problem:
    You are printing it for x or X

Hope, this would help.
Give a like if you are satisfied.

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.


I am trying to debug this but still have error. Help me.

Sure @sawarn69,

I have corrected your code:

Refer to the comments for better understanding.

1 Like