0
I don't get whats wrong. Is there someone that can help me?
#include <iostream> #include <fstream> using namespace std; int main(){ int z; char x; int y; cin >> y; cin >> x; cin >> z; switch (x){ case '+': cout << y + z; case '-': cout << y - z; case '/': cout << y / z; case '*': cout << y * z; break; } return 0; }
2 Respostas
+ 1
You must break; at the end of each case. Not at the end of the switch statement. Other than that, I don't see anything else wrong.
0
a switch case doesn't work with char because it can't compare the two values