I'm having a problem where if I try to compare a user's guess (string "userEnteredWord" which was then assigned to a corresponding array location in string "alphabet"). I cannot get the letters to display correctly, or to compare effectively. Does anyone know how I can fix this? I want to get it it display the letter where it should be, and a "_" if the letter hasn't been guessed yet.
My problem lies in voidCurrentWord::compareGuessToWord() which in in declarations.cpp.
//prevent multiple inclusions of header
#ifndef TIME_H
#define TIME_H
//Time Class definition
class CurrentWord
{
public:
string alphabet[30]; //will house guesses
int alphabetCounter; //counter to cycle alphabet string
string userEnteredWord; //user's guesses
string newWord; //sets new word
CurrentWord(); //constructor
void outputGuesses(); //output user's guesses
void inputGuesses(); //User enter letterguess
void setNewWord(); //set new word to guess
void toLowerCase(string &a); //change to lower case
void compareGuessToWord(); // compare the user's guess to the actual word that is to be guessed
private:
string buffer; // used to open word file
FILE * pFile; // used to open word file
}; // end class
#endif
This is a partial of my "declarations.cpp" with the currentword class.