Here is the code:
Code:
/*
void FindWord() // find a word from puzzle
{
std::vector<std::string>::const_iterator iter_start = wordlist.begin();
std::vector<std::string>::iterator iter_end = wordlist.end();
//std::vector<PuzzleRow> row = 0;
//std::vector<PuzzleRow> col = 0;
for (iter_start; iter_start != iter_end; ++iter_start)
{
for (PuzzleLetters::size_type i = 0; i < puzzleletters.size(); ++i)
{
for (PuzzleRow::size_type j = 0; j < puzzleletters[i].size(); ++j)
{
if ((wordlist[j][0]) == puzzleletters[i][j])
{
//LookupLister::lookup(*iter_start , puzzleletters, i, j) // look up a word
if (wordlist[j].size() <= puzzleletters[i].size() - col) // enough room ?
{
int k = 0;
while (wordlist[j][++k] == puzzleletters[i][++j]);
std::cout << "Found a word \n";
}
}
//else
//std::cout << "Word not found ! \n";
}
}
}
*/
I am trying to find a word from the puzzle by comparing each character at a time. What is the better way for comparing each character and see if the word is found in the puzzle? The puzzle contains many characters.