Hi, I need some help in making a numbered menu using C language.
Example :
1) Please enter blah blah
2) Please tell me......
3) :
Please enter your menu number....
How would I be able to link these menus , if I have already created the code that asks for the information in 1,2,3 but it's not in a number menu ?
Creating a numbered menu in C?
For a console application (dont' forget to #include conio and stdio):
char ch;
int choice = 0;
puts("1. Please enter blah blah\n2. Please tell me...\n3. :\nPlease, enter your menu number...");
while(kbhit())getch(); /*2clear input buffer from 'ghosts'*/
do
{
ch = getch();
if(ch%26gt;='1' %26amp;%26amp; ch%26lt;='3') choice = (ch-'1');
} while(choice%26lt;0);
switch(choice)
{
case 1: MyProc_EnterBlahBlah(); break;
case 2: MyProc_TellMe(); break;
case 3: MyProc_TwoDots(); break;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment