#include "stdafx.h"
#include <iostream>
using namespace std;
int main ()
{
for (int i = 0; i <= 3; i++) //give the user 4 guesses at the word.
{
std::string guess;
cout <<"Guess the word" <<endl;
cin >>guess;
if (guess == "Dog")
{
cout <<"You guessed correctly. " <<endl;
break;
}
else
{
cout <<"You guessed incorrectly. " <<endl;
}
}
char f;
cin >>f;
return 0;
}
|
||||
|
The standard idiom in C++ for doing something 4 times is:
Don't deviate from that pattern unless there is a good reason. Requiring an extra character input to exit the program is a weird user experience, especially since there is no prompt. I would just get rid of | |||||||||||||
|
| ||||
|
Looks good to me. Don't know what the last | |||||
|