the "do" and "switch"<br>
statements below are not working the way i think they should. if i remove<br>
the do statement the switch works fine. if the do statement is in the<br>
program the switch statement will go to the default everytime except when i<br>
enter 's'. what am i missing<br>
<br>
<br>
// menu template<br>
//bloc<br>
<br>
#include <stdio.h><br>
#include <conio.h><br>
<br>
void menu () {<br>
clrscr ();<br>
printf ("E: enter picks\n"<br>
printf ("V: view picks\n"<br>
printf ("L: Least picked\n"<br>
printf ("S: Save and Quit\n"<br>
}<br>
<br>
<br>
void main (){<br>
char selection;<br>
do {<br>
menu ();<br>
selection = getchar();<br>
switch (selection){<br>
case 'e' :<br>
case 'E' :<br>
printf("%c", selection);<br>
break;<br>
case 'v' :<br>
case 'V' :<br>
printf("%c", selection);<br>
break;<br>
case 'l' :<br>
case 'L' :<br>
printf("%c", selection);<br>
break;<br>
case 's' :<br>
case 'S' :<br>
printf("%c", selection);<br>
break;<br>
default:<br>
clrscr ();<br>
printf ("invalid choice\n"<br>
getchar (); getchar ();<br>
break;<br>
}<br>
}while (selection != 's');<br>
getchar();<br>
getchar();<br>
<br>
}<br>
<br>
statements below are not working the way i think they should. if i remove<br>
the do statement the switch works fine. if the do statement is in the<br>
program the switch statement will go to the default everytime except when i<br>
enter 's'. what am i missing<br>
<br>
<br>
// menu template<br>
//bloc<br>
<br>
#include <stdio.h><br>
#include <conio.h><br>
<br>
void menu () {<br>
clrscr ();<br>
printf ("E: enter picks\n"<br>
printf ("V: view picks\n"<br>
printf ("L: Least picked\n"<br>
printf ("S: Save and Quit\n"<br>
}<br>
<br>
<br>
void main (){<br>
char selection;<br>
do {<br>
menu ();<br>
selection = getchar();<br>
switch (selection){<br>
case 'e' :<br>
case 'E' :<br>
printf("%c", selection);<br>
break;<br>
case 'v' :<br>
case 'V' :<br>
printf("%c", selection);<br>
break;<br>
case 'l' :<br>
case 'L' :<br>
printf("%c", selection);<br>
break;<br>
case 's' :<br>
case 'S' :<br>
printf("%c", selection);<br>
break;<br>
default:<br>
clrscr ();<br>
printf ("invalid choice\n"<br>
getchar (); getchar ();<br>
break;<br>
}<br>
}while (selection != 's');<br>
getchar();<br>
getchar();<br>
<br>
}<br>
<br>