please help to optimize this code, it shows your program is very slow on submitting the code.
please help me. code is given below:
#include
using namespace std;
int main()
{ char ch;
int x,y;
while (ch!=βxβ or ch!=βXβ) {
cin >> ch;
switch(ch) {
case β+β: { cin >> x; cin >> y;
cout << x+y << endl;
break; }
case β-β: { cin >> x; cin >> y;
cout << x-y << endl;
break; }
case 'β: { cin >> x; cin >> y;
cout << xy << endl;
break; }
case β/β: { cin >> x; cin >> y;
cout << x/y << endl;
break; }
default : { cout << βInvalid operation. Try again.β << endl;
continue;
}
}
}
return 0;
}