All the test cases not psses ? why

#include
using namespace std;
int main() {
char ch;int a ,b;
do{
cin>>ch;
if(ch == β€˜x’ or ch == β€˜X’ )
exit(0);
if(ch == β€˜+’ or ch == β€˜-’ or ch == β€˜β€™ or ch == β€˜/’ or ch == β€˜%’ )
{
cin>>a;
cin>>b;
}
switch(ch)
{
case β€˜+’:cout<<a+b<<endl;
break;
case β€˜-’:cout<<a-b<<endl;
break;
case '
’:cout<<a*b<<endl;
break;
case β€˜/’:{if (b!=0) cout<<a/b<<endl;}
break;
case β€˜%’:{if (b!=0 ) cout<<a%b<<endl;}
break;
default:cout<<β€œInvalid operation .Try again”;
}
}while(ch!=β€˜x’ or ch!= β€˜X’);
return 0;
}

Hello @amishakumari,

Missing end line operation.
Correction:
cout<<β€œInvalid operation .Try again”<<endl;

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

Hello @amishakumari,

Why have you posted one more doubt regarding the same?
You should have asked me if it wasn’t working.

Mistakes in your code:

  1. You are not following the costraints:
    0 <= Input integers <= 100000000
    ( It is assured that the second integer provided for division and modulo operations will not be 0. )
    a and b should be of type long

  2. Missing cout<<endl; in default case.

  3. You have written wrong output statement for default case:
    Required: Invalid operation. Try again.
    Yours: Invalid operation .Try again
    Problem:
    Position of fullstop β€˜.’ and missing fullstop

  4. Wrong condition inside while

I have corrected your code:

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.