Thread: menu driven interface

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 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.

  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, 10: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, 12:52 PM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM