please explain me the program and help me with the solution
Basic calculator program
all u have to do is input numbers and characters and accordingly apply operations on them.
#include
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;
}
its not working giving me error explain me also this program
yar what are u saying… code is perfectly fine and passing all the test cases. and pls go through the course contents and if u have any difficulty share ur code where u are facing error. stop just saying every time that give me code and explain bro… tell me where u face difficulty i will surely help u
check it once again its not working that’s why I said check it once
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.