Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++!!! vector fileToWords(const string& filename) { ... } abc A Spell Checker he homework problem for this chapter combines the reading from the last
C++!!!
\
vector
...
}
abc A Spell Checker he homework problem for this chapter combines the reading from the last three chapters into a single, larger problem, where write a Spell Checker program Upload the starter code to your workspace, and then read through the instructions here. For this assignment you have to write two kinds of functions The fileToWords () function opens and reads a file, and returns a vector of string as described below. The spellCheck() function checks the spelling of all words in a stream. It reads a word from the stream and checks whether it is contained in a list of correctly-spelled words. If the word is in a list of excluded (common) words, you should just ignore it. . . Part 1- fileToWords0 We're going to use the standard UNIX word list. On the version of Linux that we are using, it is in /usr/share/dict/words. I have also created a file named excluded.txt that you should use for these tests as your words to ignore The fileToWords() function takes one parameter, a const path to the file to open. Your function should work like this: string&containing the Open an input file, using the file name If it can't be opened Then throw invalid_argument exception Create an empty vector of string (results) Read the input until end of file (getline) Store each word in the vector (push_back) Return the results vector
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started