I need help, please,
here's the problem and it needs to be done as a parallel
array.
Input:word, letter guess
Processing items:
two six-element character arrays
number of incorrect guesses counter
1. get a word from the user, store word in the word array,
store dashes in the guesses array (getword function)
2. repeat while(user has not exceeded six incorrect guesses
and user has not guessed the word)
display contents of the guesses array
display number of guesses remaining
get a letter guess from the user
(getletterguess function)
search word array for letter, replace dash with correct letter (searchword function)
end while
3. if (user guessed word)
display "Congratulations" message and contents of word array
else
display "Sorry" message and contents of word array
end if
output: message, number of incorrect guesses, guesses, and word
now here's how I have started out.
#include<iostream>
#include<string.h>
#include<ctype.h>
//function prototypes
void getword();
void getletterguess();
void searchword();
void main()
//declare and initialize variable
char letter='';
declare and initialize arrays
char word[6]="tree";
char guesses[6]="-----";
//fillarray with data
getword(word,guesses,6);
//enter word
cout<<"Enter word, (need something to stop the loop can I
have 0 to stop the loop?): "
cin>>word;
Its at this point I get Lost with this program,
one thing is how do I get the dashes in the guesses array
and at what point do I do that,
help!
here's the problem and it needs to be done as a parallel
array.
Input:word, letter guess
Processing items:
two six-element character arrays
number of incorrect guesses counter
1. get a word from the user, store word in the word array,
store dashes in the guesses array (getword function)
2. repeat while(user has not exceeded six incorrect guesses
and user has not guessed the word)
display contents of the guesses array
display number of guesses remaining
get a letter guess from the user
(getletterguess function)
search word array for letter, replace dash with correct letter (searchword function)
end while
3. if (user guessed word)
display "Congratulations" message and contents of word array
else
display "Sorry" message and contents of word array
end if
output: message, number of incorrect guesses, guesses, and word
now here's how I have started out.
#include<iostream>
#include<string.h>
#include<ctype.h>
//function prototypes
void getword();
void getletterguess();
void searchword();
void main()
//declare and initialize variable
char letter='';
declare and initialize arrays
char word[6]="tree";
char guesses[6]="-----";
//fillarray with data
getword(word,guesses,6);
//enter word
cout<<"Enter word, (need something to stop the loop can I
have 0 to stop the loop?): "
cin>>word;
Its at this point I get Lost with this program,
one thing is how do I get the dashes in the guesses array
and at what point do I do that,
help!