Why is my switch statement looping through all scenarios and printing each case.The program works correctly, but it should break after first case if I enter a number.??????.......This is just the part of the code I'm having a problem with.............Thanks.
Code:
/* while user does not enter E */
while ( c != 'E') {
switch( c ) {
/* enqueue value */
case 'A':
printf( "Enter a number: " );
scanf( "\n%d", &item );
enqueue( &headPtr, &tailPtr, item );
printQueue( headPtr );
break;
/* dequeue value */
case 'R':
/* if queue is not empty */
if ( !isEmpty( headPtr ) ) {
item = dequeue( &headPtr, &tailPtr );
printf( "%d has been dequeued.\n", item );
} /* end if */
printQueue( headPtr );
break;
default:
printf( "Invalid choice.\n\n" );
instructions();
break;
} /* end switch */
printf( "? " );
scanf( "%c", &c );
} /* end while */
printf( "End of run.\n" );
return 0; /*