Ranges in Case control structure

Is it possible to create a range within case? I know you can handle ranges easily with nested if then else, but I wanted to do some creative programming. If it's possible, how would the syntax work? Obviously not like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
switch (shoe_size)
   {
   case shoe_size <= 6:    cout << "\nSmall.";
    break;
   
   case shoe_size <= 9:     cout << "\nMedium.";
    break;
   
   case shoe_size =< 100:    cout << "\nLarge.";
    break;
        
   default:     cout << "\nYou got big damn feet!";
   }
   


The error that comes up is "shoe_size cannot appear in a constant-expression." Just satisfying curiosity here. No rush!
Can't be done, switch cases need to be constants.

You can use fall through switch statements to semi do this but in general just use if/else if statements.
Sorry for the late reply, but thank you! This helped me in my curiosity. I like if/else if statements better than switch anyway.
Topic archived. No new replies allowed.