Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2007
    Posts
    31

    Exclamation Unanswered: 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!

  2. #2
    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 ( );

    }

  3. #3
    Join Date
    Apr 2007
    Posts
    31
    yes..i owen you a beer, but i resolved the problem. thanks enyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •