-
Explain whether or not the switch is an essential program construction.
-
Add a delete command to my menu structure which is activated by the letter d.
Answers
-
The switch can be easily done without by using a series of if instructions. It does however make programming easier
-
switch ( ch )
{
case 'D' :
case 'd' :
delete_function();
break;
case 'S' :
case 's' :
save_function () ;
break ;
case 'L' :
case 'l' :
load_function () ;
break ;
case 'Q' :
case 'q' :
quit_function () ;
break ;
default :
bad_command () ;
break ;
}