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:34 PM
Mubarak Hussain
Mubarak Hussain - avatar
1 Antwort
0
Maybe something like: case 0 ... 20 cout << case 20 ... 99 cout << Not sure never tried it. edit: @ Jamie Thanks. That is good to know. I wasn't aware that was only usable due to my compiler. I will have to remember to look out for that sort of thing
23rd Jan 2018, 7:17 PM
emmey
emmey - avatar