Like Tree1Likes
  • 1 Post By GReaper

Understanding the question

This is a discussion on Understanding the question within the C++ Programming forums, part of the General Programming Boards category; I am having some trouble understanding this question! can someone push me in the right direction!? Q3- Define a structure ...

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    6

    Understanding the question

    I am having some trouble understanding this question! can someone push me in the right direction!?

    Q3- Define a structure type to represent a word list. The structure will contain one string
    component for the language of the words (e.g., English, Japanese, Spanish), an integer component
    that keeps track of how many words are in the list, and an array of MAX_WORDS 20-character
    strings to hold the words.
    Define the following functions to work with word lists:


    a. load_word_list - takes as parameters the name of an input file and a wordlist structure to be
    filled.


    b. add_word - takes as parameters a word and a wordlist structure to modify. If the wordlist is
    already full, it displays the message “List full, word not added.” If the word is already in the
    list, it leaves the structure unchanged. Otherwise, it adds the word to the list and updates the list
    size. Do not bother keeping the list in order.


    c. contains - takes as parameters a word and a wordlist. If the word matches one of the wordlist
    entries, the function returns true, otherwise false.


    d. equal_lists - takes two wordlists as parameters and returns true if the lists are in the same
    language, have the same number of elements, and every element of one list is found in the
    other. (Hint: call contains repeatedly.)


    e. display_word_list -displays all the words of its wordlist structure parameter in four columns.


    Write a program that fills a wordlist from a data file. Then prompt the user to enter a language and
    12 words to add to a different list. Then ask the user to enter some words to search for in the first
    list using contains, and print a message indicating whether each is found. Use equal_lists to
    compare the two lists, printing an appropriate message. Finally, use display_word_list to output
    each list.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    So, what's the problem? Can't you be more specific than just copy-pasting your exercise?
    Elysia likes this.
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Jan 2013
    Posts
    6
    Quote Originally Posted by GReaper View Post
    So, what's the problem? Can't you be more specific than just copy-pasting your exercise?
    Define a structure type to represent a word list. The structure will contain one string
    component for the language of the words (e.g., English, Japanese, Spanish), an integer component
    that keeps track of how many words are in the list, and an array of MAX_WORDS 20-character
    strings to hold the words.

    Does the above mean to make a struct with:
    - string
    - int
    - string name[MAX_WORDS], where max_words is defined to be 20?


    Also, I do not understand what this is asking me to do, could someone please explain where i should start:

    Write a program that fills a wordlist from a data file. Then prompt the user to enter a language and
    12 words to add to a different list. Then ask the user to enter some words to search for in the first
    list using contains, and print a message indicating whether each is found. Use equal_lists to
    compare the two lists, printing an appropriate message. Finally, use display_word_list to output
    each list.


  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    It tells you exactly what to do; pretty much everything short of writing the code. If you don't understand it, you need to go talk to your teacher because you're not picking up on what he or she is teaching you at all.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I just need help understanding this question.
    By Moody Barrawi in forum C Programming
    Replies: 2
    Last Post: 01-06-2013, 04:32 AM
  2. Silly question understanding a simple function
    By t4yl0r in forum C++ Programming
    Replies: 3
    Last Post: 11-02-2010, 03:47 PM
  3. Question understanding casted loop
    By elwad in forum C Programming
    Replies: 14
    Last Post: 05-23-2009, 04:13 PM
  4. Quick Understanding Question
    By leopardforest@g in forum C Programming
    Replies: 18
    Last Post: 04-14-2007, 08:13 PM
  5. new question: understanding parse error
    By Pig in forum C++ Programming
    Replies: 3
    Last Post: 11-19-2003, 12:14 PM

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