-
How should the input work? If I input *32 + 14 -43 etc. I only get the output of the first command. Is this intended to work this way?
-
I was getting an error for this when I ran this in eclipse. However, it still ran. Could you tell me what’s the error? It is not highlighted in red in the IDE.
I made this code. However, I have some questions. Please find them in description
hi @sinuscoupon0s_4659768f9d9b587e, refer
#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;
}