hello guys I really need you guys help I did this programming project but there is something wrong with it and I honestly can't figure out what the problem is. the program reads the words from a txt file. but I can't make it work. all this c++ thing is new for me so I would really appreciate if someone helps me.
#include<iostream>
#include<string>
#include<stdlib.h>
#include<cmath>
#include<time.h>
#include<fstream>
#include <algorithm>
#include <cctype>
using namespace std;
string THE_WORD; // word to guess
int wrong= 0;
string soFar;
string used;
int playGame(string word);
string getWord();
char askGuess(string usedLettersStr); //tells the compiler of method askGuess
bool playAgain();
int main()
{
int misses = 0;
srand(time(NULL));
string word = getWord();
cout<<"Welcome to the hangman game.Good luck!"<<endl;
do
{
const int MAX_WRONG = 6;
while ((wrong < MAX_WRONG) && (soFar != THE_WORD))
{
cout << "\n\nYou have " << (MAX_WRONG - wrong) << " incorrect guesses left.\n";
cout << "\nYou've used the following letters:\n" << used << endl;
cout << "\nSo far, the word is:\n" << soFar << endl;
used += askGuess(used);
// end of while ((wrong < MAX_WRONG) && (soFar != THE_WORD))
}
if (wrong == MAX_WRONG)
{
cout << "\nYou've been hanged!";
}
cout<< "You missed "<<playGame(word);
cout<<" times to guess the word."<<endl;
}
//cout<< "You missed "<<playGame(word);
//cout<<" times to guess the word."<<endl;
}