Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I kinda need a lot of guidance for this Assignment... Your program will ask the

ID: 3654906 • Letter: I

Question

I kinda need a lot of guidance for this Assignment... Your program will ask the user for the name of a sorted dictionary file to use and then for the name of a text file to check. Then, to perform a spell-check on the text file, your program should look up each word of the text file one-by-one to see if it exists in the dictionary. As your program goes along checking each word, if a word is not found in the dictionary, print a message stating that the word is misspelled. If either the dictionary or text files are not valid, prompt until the user enters a correct one. Notice that this file only has words that use lower case letters and has no punctuation marks. Your program is only expected to give accurate results with these types of files in order to keep things simpler. Also, when the le has say 3 words misspelled exactly the same way in different parts of the file, it is expected that your program prints a message for each one encountered, so don't worry about this redundancy. Make sure you create your own text files when testing your program to ensure it works properly! EXAMPLE RUN: Dictionary file name: dictionary.txt What file do you need spell-checked? liberty.txt 'freedo' is misspelled.'jdging' is misspelled. 'knw' is misspelled. 'gentlement' is misspelled. 'ineitable' is misspelled. 'extentuate' is misspelled. liberty.txt has 6 misspellings. Thank you for spell checking. I am given files: dictionary.txt liberty.txt What I have: #include #include #include #include using namespace std; const int size = 415834; int main(){ int count; ifstream inputFile; string dictionary[size]; string liberty[size]; inputFile.open("dictionary.txt"); inputFile.open("liberty.txt"); return 0; }

Explanation / Answer

#include #include int main(void) { const char filename[] = __FILE__, keyword[] = "line"; FILE *file = fopen(filename, "r"); if ( file ) { char line [ 256 ]; while ( fgets(line, sizeof line, file) ) { char *word = line; while ( word = strstr(word, keyword) ) { int i; fputs(line, stdout); for (i = 0; i