Thread: creating a menu using C

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    7

    Question creating a menu using C

    i need to know how to create a simple menu in C that allows the user to pick from 12 options
    cheers

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Display your twelve items. Read input. Do something.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User KidA's Avatar
    Join Date
    Nov 2005
    Location
    Ohio, USA
    Posts
    26
    Well, I think we're going to need a few more details, such as the intended user interface platform. How to construct the menu will vary quite a bit depending on if your menu should run from a command-line, or in a Windows GUI, or in an embedded device.

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Code:
    int choice;
    do {
       printf("Please make a choice: \n"
              "1) Option One \n"
              "2) Option Two \n"
              "3) Option Three \n"
              "4) Option Four \n"
              "5) Exit \n");
       scanf("%d", &choice);
       if (choice == 1) {}
       else if (choice == 2) {}
       else if (choice == 3) {}
       else if (choice == 4) {}
       else if (choice == 5) {}
       else {
            printf("Invalid Choice");
            }
    } while (choice != 5);
    Quote Originally Posted by KidA
    or in a Windows GUI, or in an embedded device.
    Something tells me that's not what he's looking for.
    Sent from my iPadŽ

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    it is in a windows GUI

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    So make an attempt at it. Surely you have enough experience programming to give it a decent try. Look for some graphics libraries online and read the documentation.
    Sent from my iPadŽ

  7. #7
    Registered User KidA's Avatar
    Join Date
    Nov 2005
    Location
    Ohio, USA
    Posts
    26
    Quote Originally Posted by whitey82
    it is in a windows GUI
    We're getting closer! Now, what environment are you using? Are you using an IDE where you can quickly build a form using a graphic editor, or are you intending to code it manually through your source?

    If you're using an IDE such as Visual Studio or C++Builder, you should be able to find many tutorials on this very topic.

    If you're intending to code it manually, scrap that idea and get an IDE. Or, try searching the Windows Programming forum...
    "So I was sitting in my cubicle today, and I realized, ever since I started working, every single day of my life has been worse than the day before it. So that means that every single day that you see me, that's on the worst day of my life" - Peter Gibbons

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    im intending to create it using the iDE borland C++

  9. #9
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    We can't really help you (I can't help at all if it's graphical. ) with these one line discriptions of your program. You have to give details. What kind of graphics do you want it to have? Are you looking for clickable options, do you want them to type it in a text box?
    Sent from my iPadŽ

  10. #10
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    sorry, its just a plain interface that will let the user enter a number from one to twelve which will represent one one the twelve options. This could be done using a option box. yes.

  11. #11
    Registered User KidA's Avatar
    Join Date
    Nov 2005
    Location
    Ohio, USA
    Posts
    26
    Borland C++Builder? Good choice!

    There is actually a Text Editor tutorial included in the online help for C++Builder...also check out: http://www.programmershelp.co.uk/c++builder.php.
    "So I was sitting in my cubicle today, and I realized, ever since I started working, every single day of my life has been worse than the day before it. So that means that every single day that you see me, that's on the worst day of my life" - Peter Gibbons

  12. #12
    Registered User
    Join Date
    Nov 2005
    Posts
    7
    Cheers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  4. Creating a menu system
    By ICool in forum C Programming
    Replies: 9
    Last Post: 09-17-2007, 12:18 PM