1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

new to programming ..need help wit this question

Discussion in 'C' started by Jehllo876, Mar 14, 2010.

  1. Jehllo876

    Jehllo876 New Member

    Joined:
    Mar 14, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Design a game that will allow the user to choose from a group of words, depending on the word choosen compare with the word with an word generated by the computer if the words are the same issue one point to the user if not the pont goes to the computer.

    You are required to create an array of string size 10 for the user to choose from. make sure words are no greater than 3 characters.

    C++

    HELP ME OUT PLEASE
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    How far have you got and where are you stuck? Try writing the code a bit at a time and make sure each bit works before moving onto the next bit. Do you fully understand the assignment?
     
  3. Jehllo876

    Jehllo876 New Member

    Joined:
    Mar 14, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    yea i do...barely .....i get stuck at where the user is suppose to choose a word from the array and compare it with the computers word
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    What code have you got so far?
    How will the user choose a word from the array: will you display the words and ask them to pick one, and how will they identify the word: will they type the word itself in or identify it some other way? If the former what if there is a typo?
     
  5. Jehllo876

    Jehllo876 New Member

    Joined:
    Mar 14, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    yea....the array will be displayed n the user is to choose the word
     
  6. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
    steps to follow
    =========
    1) create group of words
    -find the words you want
    -put them in a char array--->char words[N][M]
    where N is how many words and M the maximum length of a word.

    2) computer word
    -calculate a random number from 0...N-1
    -rand,srand,time....
    -find the word for this random number --->words[random]

    3) print words on computer screen
    -printf,cout,...
    one , two, ..........

    4) get user input
    cin,scanf,fgets.....

    5) compare the user input with computer word
    -strcmp for example
    -if (success...) human++ else computer++

    now write your code and post it here for debugging.
     
    Last edited: Mar 16, 2010

Share This Page