#include #include #include void display_menu( void ) { printf( "Type in the appropriate number and press enter\n" "1 Converting numbers to binary\n" "2 Perform the quincy SHNORKS operation\n" "3 sort 6 names\n" "4 quit\n\n" ); } void num_to_bin( void ) { printf( "the binary program\n" ); } void quincy_SHNORKS( void ) { printf( "the quincy SHNORKS program\n" ); } void sort_names( void ) { printf( "the sorting program\n" ); } void quit( void ) { exit( 1 ); } void unknown( char c ) { if ( isprint( c ) ) fprintf( stderr, "Unknown menu choice \"%c\"\n", c ); else fprintf( stderr, "Unknown menu choice: character with ASCII value \"%d\"\n", c ); } int menu( void ) { char choice; while ( 1 ) { display_menu(); scanf( " %c ", &choice ); switch ( choice ) { case '1': num_to_bin(); break; case '2': quincy_SHNORKS(); break; case '3': sort_names(); break; case '4': case 'q': case 'Q': quit(); break; default: unknown( choice ); break; } } } int main( void ) { menu(); return 0; }