home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
switch1.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-19
|
719b
|
37 lines
// Program demonstrates the multiple-alternative switch statement
#include <iostream.h>
main()
{
char c;
cout << "Enter a character : ";
cin >> c;
switch (c) {
case 'A':
case 'B':
case 'C':
case 'D':
// other case labels
cout << "You entered an uppercase letter\n";
break;
case 'a':
case 'b':
case 'c':
case 'd':
// other case labels
cout << "You entered a lowercase letter\n";
break;
case '0':
case '1':
case '2':
case '3':
// other case labels
cout << "You entered a digit\n";
break;
default:
cout << "You entered a non-alphanumeric character\n";
}
return 0;
}