How should i approch this question by using do while .. i have done this problem by using switch statement

#include
using namespace std;
int main() {
char ch;
int a,b,c;
cout<<“enter a charecter \n”<<endl;
cin>>ch;
switch(ch)
{
case ‘+’:
cout<<“enter two numbers \n”<<endl;
cin>>a>>b;
c=a+b;
cout<<c<<endl;
break;

	case '-':
	cout<<"enter two numbers \n"<<endl;
	cin>>a>>b;
	c=a-b;
	cout<<c<<endl;
	break;	

	case '*':
	cout<<"enter two numbers \n"<<endl;
	cin>>a>>b;
	c=a*b;
	cout<<c<<endl;
	break;		

	case '/':
	cout<<"enter two numbers \n"<<endl;
	cin>>a>>b;
	c=a/b;
	cout<<c<<endl;
	break;	

	case '%':
	cout<<"enter two numbers \n"<<endl;
	cin>>a>>b;
	c=a%b;
	cout<<c<<endl;
	break;	

	case 'x':
	case 'X':
	break;
	
	default:
	cout<<"Invalid operation" <<endl;
	
}
return 0;

}

switch is best for this question
no need to do same question with do while

if you want to do it for practice, you can use dowhile loop also but it req some extra efforts
send your code of dowhile i will check and make necessary changes

but by using switch no test case are passed

Logic is correct but you are printing unnecessary print statements that’s why your code is not passing testcases.

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.