home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list6_5.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
728b
|
36 lines
/* Demonstrates a simple do...while statement */
#include <stdio.h>
int get_menu_choice( void );
main()
{
int choice;
choice = get_menu_choice();
printf( "You chose Menu Option %d", choice );
}
int get_menu_choice( void )
{
int selection = 0;
do
{
printf( "\n" );
printf( "\n1 - Add a Record" );
printf( "\n2 - Change a record");
printf( "\n3 - Delete a record");
printf( "\n4 - Quit");
printf( "\n" );
printf( "\nEnter a selection:" );
scanf( "%d", &selection );
}while ( selection < 1 || selection > 4 );
return selection;
}