#include
#include<math.h>
using namespace std;
int main()
{
char ch;
ch=cin.get();
int n1,n2;
int ans=0;
while(1)
{
if ((ch==’’)||(ch==’+’)||(ch==’/’)||(ch==’%’)||(ch==’-’))
{
cin>>n1;
cin>>n2;
if(ch==’+’)
ans=n1+n2;
if(ch==’-’)
ans=n1-n2;
if(ch==’’)
ans=n1*n2;
if(ch==’/’)
ans=n1/n2;
if(ch==’%’)
ans=n1%n2;
cout<<ans<<endl;
}
else if((ch==‘X’)||(ch==‘x’))
exit(0);
else
{
cout<<“Invalid operation. Try again.”<<endl;
}
ch=cin.get();
}
return 0;
}
OUTPUT:
2
Invalid operation. Try again.
Invalid operation. Try again.
2
Invalid operation. Try again.
Invalid operation. Try again.
5
Invalid operation. Try again.
Invalid operation. Try again.
Invalid operation. Try again.
Invalid operation. Try again.
Invalid operation. Try again.
EXPECTED OUTPUT:
2
2
5
Invalid operation. Try again.
PLEASE HELP ME!!