Hi. I want to create a speller that will read in a txt file called Plain and read in a dictionary txt file called words. Then I want to check each word in the text file to see if it is spelled correctly or not by comparing each word to every word in the dictionary. If it isn't in the dictionary, it would be misspelled and outputted. FYI: all i know so far in C++ is stream, arrays, loops, structures, classes, if statements, variables, and functions.
// set up the max size of the dictionary.
constint Dictionary_Size(50000);
ifstream words;
string dict[Dictionary_Size];
int nArrayIndex = 0;
words.open("C:\\Users\\Kevin Nguyen\\Desktop\\words.txt");
if(words.good())
{
// lets read in the dictionary.
while(!words.eof());
{
// I don't know if I need to normalize these words to all upper or lower case.
words >> dict[nArrayIndex]; // fill the array with words.
// increment the index.
nArrayIndex++;
}
cout << "Dictionary has " << nArrayIndex+1 << "words in it." << endl;
}
else
{
cout << "Had a problem opening words!!" << endl;
}
After I read in my dictionary I would open plain, and looping my reads to the end of file. After reading each word I would normalize it, convert it to upper or to Lower case which ever matched my dictionary. Then I would scan the dictionary with each read in word and see it was there or not. In my example, nArrayIndex is the number of words read in, which assumes only that I didn't know how many words were in the Words file.
I hope you can see the direction I am pointing you in.