Check Multiple Numbers With a Switch Statement

I am having a problem with switch statements. I would like to check multiple numbers in one case, but can't figure out how to do so. Any help would be appreciated :)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int i = 5; // any value here
switch (i){

case 0:
case 1:
case 2:
case 3:
case 4:
cout << "i = " << i << endl;
break;
case 5:
cout << "i = 5" << endl;
break;
default:
break;
}




You got the idea ....
Topic archived. No new replies allowed.