#include
using namespace std;
int main()
{
char ch;
float num1, num2;
cin >> ch;
cin >> num1 >> num2;
if(ch=='+')
{
cout << num1+num2;
}
else if(ch=='-'){
cout << num1-num2;
}
else if(ch=='*'){
cout << num1*num2;
}
else if(ch=='/'){
cout << num1/num2;
}
else if(ch=='X' || ch=='x'){
break;
}
else {
cout << "Invalid operation.Try again"<<endl;
}
return 0;
}
In line number 37 I’m getting error as “break statement not within loop or switch”. Why is this happening?