If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Help I want to make a simple menu in C

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-23-07, 16:53
flobeats flobeats is offline
Registered User
 
Join Date: Apr 2007
Posts: 31
Exclamation Help I want to make a simple menu in C

Hi, i need help. I want to make a simple menu in C.
I have made a program I have 2 functions readTemp() and writeTemp()
void main()
{
}

printf("1.Read Temperature");
printf("2. Write Temperature");

void readTemp()
{
getch();
}

void writeTemp()
{
getch();
}

I know is samethink with
switch()
case '1': readTemp(); break;
case '2': writeTemp(); break;

pls somedody help!
Reply With Quote
  #2 (permalink)  
Old 05-20-07, 05:06
wah_wah_69 wah_wah_69 is offline
Registered User
 
Join Date: Apr 2007
Posts: 10
Thumbs up

char option = null;
int exit = 0;

option = getchar ( );

do while( !exit){

switch(option){
case 'A': Do some stuff
break;

case 'B': Owe me a beer
break;

case 'X': exit = 1;
break;
}

option = getchar ( );

}
Reply With Quote
  #3 (permalink)  
Old 05-20-07, 17:03
flobeats flobeats is offline
Registered User
 
Join Date: Apr 2007
Posts: 31
yes..i owen you a beer, but i resolved the problem. thanks enyway.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On