I've been having some difficulties with the check function. It seems to work when all the words in my text file are lowercase but any capital letters are returned as misspelled.
I iterate through through both the dictionary and text characters and use the tolower function. My program also doesn't return the last word in a text file if it is misspelled. Can you give me any help? *Updated
bool check(const char* word)
{
char word2[strlen(word) + 1];
strcpy(word2, word);
int check = 0;
for(int i = 0; word2[i] != '\0'; i++)
{
if(isalpha(word2[i]))
{
word2[i] = tolower(word2[i]);
}
}
int index_value = hash_it(word2);
node* cursor = hashtable[index_value];
while(cursor != NULL)
{
check = strcmp((cursor -> word), word2);
if(check == 0)
return true;
cursor = cursor -> next;
}
return false;
}