Please tell whats wrong in my code


I am just able to get the first output but I m not able to give constant inputs after the first calculation. Please tell my mistake

hi @akshat1409
Have a look at this code–>

#include<iostream>
using namespace std;
int main() {
	int a,b,c;
	char ch;
	do
	{
		cin>>ch;
        if((ch=='X')||(ch=='x'))
        {
            break;
        }
        else if(ch=='+' || ch=='-' || ch=='*' || ch=='/' || ch=='%')
        {
			cin>>a>>b;
		switch(ch)
		{
			case '+':c=a+b;
			break;
			case '-':c=a-b;
			break;
			case '*':c=a*b;
			break;
			case '/':c=a/b;
			break;
			case '%':c=a%b;
			break;
		}
		cout<<c<<endl;
        }
		else
		{
			cout<<"Invalid operation. Try again."<<endl;
		}
	}
	while(1);
	return 0;
}

you have used a lot of things we have not been taught like #include<iostream> , cin>>ch; Please send a simple code which has concepts taught to us in coding blocks master cpp course

Also the code is incorrect and is not working. It has a lot of errors

Hey, one is header file and other thing is just to taking input of character. I think these are just really basic things of coding. And try submitting the code again. It’s working fine and passing all test cases.

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.