0
In switch function how to write the number limit in the case?
If we are asked to write the age limit for a child an adult and senior citizen
2 Answers
+ 4
you can do:
case 1:
case 2:
case 3:
...
case 12:
cout<<"too young!"<<endl;
break;
but that would be too much code. use if-else instead and check for age>1 && age<12 for example.
0
Then can't we write a program on age limit using switch function