home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list13_6.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
850b
|
43 lines
/* Demonstrates the switch statement correctly. */
#include <stdio.h>
main()
{
int reply;
puts("Enter a number between 1 and 5, 0 to exit:");
scanf("%d", &reply);
switch (reply)
{
case 1:
{
puts("You entered 1.");
break;
}
case 2:
{
puts("You entered 2.");
break;
}
case 3:
{
puts("You entered 3.");
break;
}
case 4:
{
puts("You entered 4.");
break;
}
case 5:
{
puts("You entered 5.");
break;
}
default:
puts("Out of range, try again.");
}
}