arrays and strings

im having a hard time with a hangman game i have to read in the file of the sentences that will be use and the shapes each time a player get a letter word it print the figure when i do the void function i can enter a letter but dont see if it there or not and i dont know how to implement the figure when they get the answer wrong i asssume it would be

if(guess == 0)//something like that but not sure
{
//print figure
}


void playGame(string figure[], string sentence[]){

string display;
string word;
int words =11;
int misses=0;
int i = rand()%11;
word = sentence[words];
display =sentence[words];

for(int i =0; i < display.length(); i++)
display[words] ='_';
cout << "ready to play the game!";
while(1)
{
cout << "\nenter a letter in word ";
cout << display << " : ";
char response;
cin >> response;

bool guess =false;
for(int i =0; i< word.length(); i++)
if(response == word[words])
{
display[words]=word[words];
guess =true;
}
if(!guess)
misses++;
cout << response << "\nnot there" << endl;


}


}
here the sentence file:
the boy who could fly
chairs and tables
my name is bob
sometimes i worry about you
what goes around comes around
it high noon
umbrella
want to play some basket ball
time flys when your having fun
what happen to you
boys
here the figure file:
\-\-\-\-\-\
\-\-\-\
\-\-\
\-\
Last edited on
Topic archived. No new replies allowed.