Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   new to programming ..need help wit this question (http://www.go4expert.com/forums/programming-help-wit-question-t21353/)

Jehllo876 14Mar2010 08:58

new to programming ..need help wit this question
 
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

xpi0t0s 14Mar2010 14:27

Re: new to programming ..need help wit this question
 
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?

Jehllo876 15Mar2010 05:14

Re: new to programming ..need help wit this question
 
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

xpi0t0s 15Mar2010 15:28

Re: new to programming ..need help wit this question
 
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?

Jehllo876 16Mar2010 06:43

Re: new to programming ..need help wit this question
 
yea....the array will be displayed n the user is to choose the word

virxen 16Mar2010 16:35

Re: new to programming ..need help wit this question
 
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.


All times are GMT +5.5. The time now is 01:42.