HERE IS MY CODE, PLEASE LET ME KNOW MY MISTAKE AS I CAN’T FIND IT.
#include
#include
using namespace std;
int main () {
char ch;
int N1 , N2;
int max = INT_MAX;
int counter = 1;
do {
cin>>ch>>N1>>N2;
switch (ch) {
case '+':
cout<<(N1 + N2)<<endl;
break;
case '-':
cout<<(N1 - N2)<<endl;
break;
case '*':
cout<<(N1 * N2)<<endl;
break;
case '/':
if (N2 != 0){
cout<<(N1 / N2)<<endl;
}
break;
case '%':
if (N2 != 0){
cout<<(N1 % N2)<<endl;
}
break;
case 'X':
case 'x':
break;
default:
cout<<"Invalid operation. Try again."<<endl;
}
counter++;
}
while (counter <= max);
return 0;
}
