C program

This is a discussion on C program within the C Programming forums, part of the General Programming Boards category; Write a program that determine if a word is in dictionary data file program to do the following: Menu Look ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    1

    C program

    Write a program that determine if a word is in dictionary data file program to do the following:
    Menu
    Look up word
    Add new word to dictionary
    Print the content of data file (dictionary)
    Exit

    I need help to start this program i have never put a menu in a program before, so could you please help me.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Code:
    int menu(void)
    {
      int selection=-1;
      do
      {
        puts("Welcome to C Programming's Message board\nPlease make your selection\n");
        puts("1) I would like to post some code");
        puts("2) I am a lazy dumb arse");
        puts("3) I'm not sure if I'm being insulted or not");
        puts("4) I could swear void main() was my friend");
        puts("selection: ");
        if ( scanf("%d, &selection) != 1 )
        {
          int ch;
          while ( (ch=getchar()) != ' ' );
          selection = -1;
        }
        else
          if ( selection <= 0 || selection > 4 )
            puts("Wow you really are dumber then you look");
      }while (selection <= 0 || selection > );
      return selection;
    }

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006


    [pedantic]
    Code:
    if ( scanf("%d", &selection) != 1 )
    Missing closing double-quote.

    Code:
    }while (selection <= 0 || selection > 4? );
    Missing condition.

    [/pedantic]
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    [cover up]Of course they could be intentionally induced errors to keep people from copy/pasting[/cover up]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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