Please review my code and analyse mistake

send me a note of my mistakes

#include
using namespace std;

int calculator(char ch){

	do{
		char ch;
		cin>>ch;
		
		int N1,N2 ;
		cin>>N1>>N2;

		if(ch=='+'){
			cout<<N1+N2<<endl;
		}

		else if(ch=='-'){

			cout<<N1-N2<<endl;
		}


		else if(ch=='*'){

			cout<<N1*N2<<endl;
		}


		else if(ch=='/'){

			cout<<N1/N2<<endl;
		}


		else if(ch=='%'){

			cout<<N1%N2<<endl;
		}
		
		else{
			cout<<"Invalid operation.Try again"<<endl;
		}

	}

	while((ch=='X')or(ch=='x')) ;

}
int main() {

char ch;
cin>>ch;

calculator(ch);
cout<<calculator(ch)<<endl;

return 0;

}

Please save your code on ide.codingblocks.com and then share its link…

Your code is not giving the desired output even for the sample test case. Also i can see that the condition for while loop is wrong. You have to take input until the input character is not X or x but you have used the condition
while((ch==β€˜X’)or(ch==β€˜x’))… Please dry run your code with the sample case to check your mistakes here.

while((ch==β€˜X’)or(ch=='x)) is the exit condition na
and the things which have to be done is written inside do{}

Yes they are the exit condition but after each iteration/set of inputs, the condition is checked.
SO while((ch==β€˜X’)or(ch=='x)) will give false after the first iteration only and control will come outside the loop .Please dry run you code with the sample case.