I've been working on this game to guess the secret word, but i've had more problems than success. I'm rusty on my C++ and never was very fluent and I can't figure out how to get the game working right. What I mean is the program needs to go through a loop 5 times or until you guess the secret word. I can't figure out the loop part it's been giving me trouble for days now. With the code that i have right now it will only go thought the loop 2 times before going into an ifinite loop. If anybody could help we figure out how to make this work would be great. Thank alot.
#include<iostream>
#include<string>
using namespace std;
int main()
{
int count= 1;
string SECRET_WORD = "binary";
string SECRET_GUESS;
OK. I changed the lines of code and now it won't exit the loop or accept the "binary" as the secret word. I'm sorry, I really suck at loops in C++. Here is my code now after the changes. The loop needs to go 5 times or until and Guess the right word which is "binary". Thanks, again.
#include<iostream>
#include<string>
using namespace std;
int main()
{
int count= 1;
string SECRET_WORD = "binary";
string SECRET_GUESS;
I'm sorry to bother again, but how do make the program display "Thank you for playing" only when you didn't guess the correct word and ran out of guesses. Right now the program displays "Thank you for playing" after I guess the right word, but i don't want it to do that. And it says "Correct the secret word was binary" after the loops exits even if you didn't guess the right word. I know that the problem is that the cout if after the loop and will display no matter what, but how do i fix it so it only display a specific message after the loop. Like if i didn't guess the word it should onyl display "Thank you for playing" and if i did guess the right word it should onyl display "Correct the secret word was binary". I know i'm a bother and i'm sorry I just can't figure this out for some reason. Thanks alot.
Sorry I forgot to add code, sorry.
#include<iostream>
#include<string>
using namespace std;
int main()
{
int count= 1;
string SECRET_WORD = "binary";
string SECRET_GUESS;