Basic calculator

where am i wrong in this code gven below ?

Problem :- Basc calculator

solution:-

#include
using namespace std;

int main() {
char ch;
cin>>ch;
int a,b,c,flag=0;
do{
if(ch==’+’)
{cin>>a>>b;
c=a+b;
cout<<endl<<c;
flag=1;
}
else if(ch==’-’)
{cin>>a>>b;
c=a-b;
cout<<endl<<c;
flag=1;
}
else if(ch==’’)
{
cin>>a>>b;
c=a
b;
cout<<endl<<c;
flag=1;
}
else if(ch==’/’)
{
cin>>a>>b;
c=a/b;
cout<<endl<<c;
flag=1;
}
else if(ch==’%’)
{
cin>>a>>b;
c=a%b;
cout<<endl<<c;
flag=1;
}
else if(ch==β€˜X’ || ch==β€˜x’)
{
flag=1;
break;
}
else
{
cout<<β€œInvalid character”;
flag=1;
}
}while(flag=0);
return 0;
}

hi @discobot,
updated

Hi! To find out what I can do, say @discobot display help.

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.