for (i = 0; i > 4; ++i); // <--semicolon and loop never runs because 0 < 4
Also you probably want to exit the loop when the user guess the answer, so you need to add break after your "Congratulations ..." message
srand((unsigned)time(NULL));
do {
ranhint = rand() % 7;
string answer = vcolour.at(ranhint);
string guess = vhints.at(ranhint);
cout << (vhints[ranhint]) << endl;
cout << "Remember to put your answer in lower case please." << endl;
for (i = 0; i < 3; ++i);
{
getline(cin, guess);
if (guess == answer)
{
cout << "Congratulation on a job well done." << endl;
}
else
{
cout << "You guessed well but......WRONG" << endl;
}
}
cout << "Do you want to play again Yes/No?" << endl;
getline(cin, run);
} while (run == "Yes");
and when i try and set guess > i it will not run because guess is a string and i is an int.
Well yours is missing a condition to stop the loop when the guess was found look at the earlier replies. You are going to want to loop only and only if i < 3 and guess != result.
You are still not removing that semi colon I mentioned in my first post. Your loop runs 3 times but since you have the semicolon, the block of code under the loop is only executed after the for-loop has finished