Basic calculator challenge

what is wrong in my logic please mark the mistake

#include
using namespace std;
int main() {
int n1,n2;
char ch;
cin>>ch;

while(ch!='X' || ch!='x'){
    if(ch!='+' || ch!='-'|| ch!='*' || ch!='/' || ch!='%'){
        cout<<"Invalid operation. Try again.";
        return 0;
    }
    switch(ch){
        case '+': 
          cin>>n1>>n2;
          cout<<n1+n2<<endl;
          break;
        case '-': 
          cin>>n1>>n2;
          cout<<n1-n2<<endl;
          break;

        case '*': 
          cin>>n1>>n2;
          cout<<n1*n2<<endl;
          break;
           case '/': 
          cin>>n1>>n2;
          cout<<n1/n2<<endl;
          break;

           case '%': 
          cin>>n1>>n2;
          cout<<n1%n2<<endl;
          break;
          cin>>ch;
    }

}
return 0;

}

Hello @sk3657860,

You are not handling the following properly:

  1. If ch is any other character, the program should print ‘Invalid operation. Try again.’ and seek inputs again (starting from character).

    1.1. you should use logical and operator instead of logical or
    1.2. you are terminating the program.

  2. The position of the input statement is inappropriate.

  3. The outer while loop should also use logical and operator instead of logical or.

I have modified your code:

Suggestion:
Study the difference between and use of Different operators.

HINT:
&& : Will execute the enclosed statements if and only if all the conditions will satisfy.
||: Will execute the enclosing statements if any one or more conditions satisfies.

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