well whats wrong with that you ask?
Code:
int menu ( void )
{
int i;
char selection[BUFSIZ];
printf( "%55s","*************************************\n");
printf( "%55s","** swiftline airlines fleet menu. **\n");
printf( "%55s","*************************************\n");
printf( "\n" );
printf( "%50s","to choose , enter the letter\n");
printf( "\n");
printf("1) Show number of empty seats\n");
printf("2) Show list of empty seats\n");
printf("3) Show alphabetical list of seats\n");
printf("4) Assign a customer to a seat assignment\n");
printf("5) Delete a seat assignment\n");
printf("6) Quit\n");
printf("\n");
do {
printf( "choose your menu\n");
if( i == 6 )
break;
i = atoi( fgets ( selection, sizeof selection , stdin ));
}while ( i < 1 || i > 5 );
return i;
}
so inside main i have this:
Code:
int main(int argc, char *argv[])
{
int choice, i = 0;
char ch;
while (( choice = menu()) != 6 ) {
switch( choice )
{
case 1:
printf("yes\n");
break;
case 2:
break;
case 3:
break;
case 4:
printf( "customers first name:\n");
while ( fgets ( seat[i].fname[0], sizeof seat[i].fname, stdin ) != '\0') {
fgets(seat[i].fname, sizeof seat[i].fname , stdin);
printf( "customers last name:\n");
fgets( seat[i].lname, sizeof seat[i].lname , stdin );
}
so each case is going to be something different. so i dont need to have a loop like he suggested i dont see how it would work for my situation?
i wanted a loop inside case 4. is that not a good choice?