View Single Post
Old Nov 16th, 2006, 2:11 AM   #18
aznballerlee
Hobbyist Programmer
 
Join Date: Nov 2006
Posts: 111
Rep Power: 3 aznballerlee is on a distinguished road
Yes, I fixed those errors. Thanks for pointing them out:

I have one last bug to fix now:
bool doesNotExist (char guess[MAXWORDLENGTH+1])
{
   for (int h=0; h < MAXWORDS; h++)
   {
	if (strcmp (wordList[h], guess) != 0)     // check if guess is not in wordList
       return true;
   }
   return false;
}


this is in another function:
if (doesNotExist (guess))
{
      cout << " I don't know that word" << endl;
	break;
}

What my problem is that in the bool doesNotExist function, when I run the loop, I get the return true prematurely. For example, if the first element I'm comparing is not in wordList, I return true already. When what if the second element that I'm comparing IS in wordList, I can't reverse this.

So somehow I have to change the code .. maybe include a break .
My point in that function is to return true when I go throguh each element in wordList and find that guess is not in there. If guess is in wordList, then I return false.
aznballerlee is offline   Reply With Quote