0
Inputs in a switch function.
I'm using cin to input a variable at the begging of the code, but when I use the function switch to evaluate that input deppending on the given value, the cin inside the "case" don't work, do I have to do something special on the swith functions to can input something? Thanks
1 Answer
+ 2
Here is the proper way to do it:
int n;
cin >> n;
switch(n){
case 42:
//do stuff
break;
//put more cases here
}