menu driven interface

This is a discussion on menu driven interface within the C Programming forums, part of the General Programming Boards category; I need help doing a menu driven database program. I need a Main Menu, with a few options. One of ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    2

    Unhappy menu driven interface

    I need help doing a menu driven database program. I need a Main Menu, with a few options. One of the options is to create a new record in a table. Can anyone help me go from a main menu screen to the actual database to create a new entry?
    Thanx!

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    Code:
    do{
          printf("1.  Make a new database\n");
          printf("2.  Add a person\n");
          printf("3.  Remove a person\n");
          /*blah blah blah*/
          fgets(buffer,sizeof buffer,stdin);
       while(buffer[0]!=1|| buffer[0]!=2|| buffer[0]!=3);
       if(buffer[0]==1)
          add_database();
       /*blah blah rest of code*/

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,590
    > buffer[0]!=1
    Should be
    buffer[0]!='1'
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    you knew what I meant

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    2
    Thanx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. URGENT! Menu driven & records handling
    By ravccc in forum C Programming
    Replies: 5
    Last Post: 11-18-2005, 11:52 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21