I modified my code so it would be simpler I just want to know how would I put a limit so it would only have 6 times to guess if the does guess by the 6 time your dead. how would I put a limit on this code to stop at 6 guesses and anyone help me please.
here is the code
this code works fine but the thing is the it doesn't have a limit to 6 guesses it stop until the word is reveal word by word can anyone help me. but the word are from a text file
her is the code
#include<iostream>
#include<string>
#include<stdlib.h>
#include<cmath>
#include<time.h>
#include<fstream>
using namespace std;
int playGame(string word);
string getWord();
int main()
{
int misses = 0;
srand(time(NULL));
string word = getWord();
cout<<"Welcome to the hangman game."<<endl;
cout<<"You only have 6 time to guess. Good luck!"<<endl;
cout<< "You missed "<<playGame(word);
cout<<" times to guess the word."<<endl;
}