Stuck on hangman
I am coding hangman for a project. My teacher supplied us with this code:
It is suppose to return the hidden word with the correct words the player guessed revealed.
string show_hidden_letter(string secret, string hidden, char guess)
string result = hidden;
for (unsigned i = 0; i < result.length(); i++)
if (secret[i] == guess)
result[i] = guess;
Now what I am stuck on is how to use this function. I have declared the prototype at the top already and have the function underneath the int main.
How do we use this function in int main?
I am the random word picked by the computer as "word", the word replaced with stars as "secret", and the letter chose by the person as "a".
So I know it involves something like this in the int main:
show_hidden_letter(word, secret, a) but I don't know how to use it nor how to cout the new updated version where the correct letter is revealed.
Please help me with this. I am not looking to be spoon fed but is willing to learn how to use this function properly. Thank you in advance.
The function returns a string. How do you get that string from the function? What should you do with it after you get it?