Quick C++ hangman game question!!!?

Timmy

New member
How would I write out a hangman game that involves the usage of functions? This is the function is needed to be used:

string show_hidden_letter(string secret, string hidden, char guess)
{
string result = hidden;
for (unsigned i = 0; i < result.length(); i++)
if (secret == guess)
result = guess;
return result;
}


However how would I put that into my int main?

I defined the user's answer as char a. The word to be guessed is "secret" and the real word is "word".

My int main looks something like this:
*
*
*
cout << "Enter your guess";
cin >> a;

The * just means I have other codes above that and it picks the word to be used and declares variables.

Please help me with this!
 
Back
Top