new to programming ..need help wit this question

Jehllo876's Avatar, Join Date: Mar 2010
Newbie Member
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's Avatar, Join Date: Aug 2004
Mentor
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's Avatar, Join Date: Mar 2010
Newbie Member
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's Avatar, Join Date: Aug 2004
Mentor
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's Avatar, Join Date: Mar 2010
Newbie Member
yea....the array will be displayed n the user is to choose the word
virxen's Avatar, Join Date: Nov 2009
Pro contributor
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 by virxen; 16Mar2010 at 16:38..
Jehllo876 like this