Hey,have been having a problem with this code,dont no what to do here,trying to find the letter in the secret word in hangman.when the user inputs their choice how do i compare it with the secret word.was using a for loop but not sure
cout<<"\n\t\t *********** H A N G M A N ***********\n\n";
cout<<"\n\t\t Welcome to To the game of Hangman \n\n";
cout<<"\n\t\t Guess the letters of the random word \n\n";
srand((unsigned)time(NULL));
num = rand() % 9 + 0;
word_to_guess = words[num];
strsize = word_to_guess.size();
lives = word_to_guess.size();
lives = lives + 2;
cout<<"Guess the secret word it has "<<strsize
<<" letters and you guess one letter at a time "<<endl<<endl;
wordguessed = word_to_guess;
for(int i = 0; i<word_to_guess.size();i++)
{
word_to_guess[i] = 'X';
}
cout<<word_to_guess<<endl<<endl;
while (lives>0 && wordguessed!=word_to_guess)
{
cout<<"You have "<<lives<<" guesses left"<<endl<<endl;
cout<<"Please enter your guess"<<endl<<endl;
cin>>guess;
lives = lives -1;
lettersguessed = lettersguessed + guess;
for(int h =0;h<word_to_guess.size();h++)
{
word_to_guess[h]== guess;
}