I am currently having trouble converting my thoughts to code. Essentially, I am being tasked with reading lines from a text file. Because I will be accessing individual words from each line, I believe I need to store each line as a vector with each element of the vector being a word from the line. The words from each line will have to be accessed before moving onto the next line in the file. I understand I will probably use getline and stringstream, but I am stuck as to how to store each line from the getline as a vector of individual words.
For example, if I have the following lines in a text file:
This is the first line of the text file. This is the second line of the text file.
I should be able to extract the words "This" and "first" from the first line and the words "This" and "second" from the second line. I do not need the extracted words from the first line when I move onto the second line.
Source: Windows Questions C++