I am writting a word Ladder game. I think I'm done with my code, I already split it up and I was trying to print out a mock solution. Basically what it is is you give it two words, a destination and a origin. The program will convert the origin word to the destination word by only changing one letter at the time and referencing a word bank to check for real words. I think everything is fine in my code, but for some reason I get about 21 errors. This is the part on the bottom of my code and the part that I believe is failing. (Header.h; retrieve all possible words parameters)
Header.h
1 2 3 4 5 6 7
class wordLadder
{
public:
wordLadder();
void print();
void searchAllPossibleWords(string word, string dest);
void retrieveAllPossibleWords(string word, string dest, vertex *V); // here
and this is where I pass it on the implementation...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void wordLadder::searchAllPossibleWords(string word, string dest)
{
origWord = word;
vertex * V = new vertex;
V->word = word;
for (int i = 0; i < 4; i++)
{
V->word[i] = '*';
retrieveAllPossibleWords(V->word,dest, V); //here
V->word = word;
cout << endl;
}
}
and
1 2
void wordLadder::retrieveAllPossibleWords(string word, string dest, vertex *V) //here
is this how you pass a Pointer? I tried many differen combinations (With the 'address of' operator aswell... any help will be appreciated. Thanks!!!
I defined them in terms of each other attempting to create a graph-like data structure, but I wasn't able to define them under the same header file so that's why I put them in their own header files. I wasn't thinking about the memory space at the time, but I think I may be requesting infinite memory... But I still don't think that's the reason for the compiling errors, what do you think?