0

Can we put "greater then, less then or equal to" with switch statement??

For example; can we write like this in switch statement: switch(age){ case <=20; cout<<"statement "; break; }

23rd Jan 2018, 6:33 PM
Mubarak Hussain
Mubarak Hussain - avatar
1 Resposta
0
no switch statements are locked but you could have one statement fall into another switch(a) { Case 10: case 11: case 12: cout << "in range of 10-12" << endl; break; case 20: break; } but in practice I wouldnt use this.
23rd Jan 2018, 8:19 PM
John
John - avatar