// CS19 C++ Fall 2005 Cinco! Word Guessing Game // (Optional/Hint) starter code by Steve J. Hodges // --- // you may use the provided class definitions, modify them or discard // my code, at your preference // You may use either C++ Strings or character arrays for storage class Dictionary{ public: Dictionary(char *filename=""); // arg: filename of input words text file ~Dictionary(); bool validWord(char *word); // check if word is in Dictionary char *getLegalSecretWord(); // return a random word (w/out repeated letters) private: bool testSecretWord(int n); // test if word n has only unique letters char **words; // char arrays of words {size: numwords by 5+1} int numwords; // number of words in the dictionary }; class Cinco{ public: Cinco(){ cheated=false; numguesses=0; dict = new Dictionary("words5.txt");} void start(){ ConsoleUI(); } // public interface to play game of cinco private: int countMatchingLetters(char *, char *); // find common letters in any order int countInPlaceLetters(char *, char *); // find common letters in place void ConsoleUI(); // play the game with text/keybd/screen UI Dictionary *dict; // legal words for the game int numguesses; // track number of guesses used bool cheated; // flag set to true if cheat code is used char secret[5+1]; // word to guess }; main(){ srand(time(0)); Cinco c; c.start(); }