Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parallel array

Status
Not open for further replies.

ggreg

Programmer
Mar 9, 2001
201
US
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]=&quot;tree&quot;;
char guesses[6]=&quot;-----&quot;;

//fillarray with data
getword(word,guesses,6);


//enter word
cout<<&quot;Enter word, (need something to stop the loop can I
have 0 to stop the loop?): &quot;
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!








































 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top