I have been thinking about an assignment for couple of days and tried some methods but none works really perfect; I certainly don't need code, I just need some problem solving assistance. The question is, I'm supposed to read a text from a file, and then put them into 2 linked list. One(Outer) keeps the paragraphs, one(Inner) keeps the strings. Up until here it's fine, but the problem is I don't know how to read the text to recognize the paragraphs. In other words, if I use, say, "fin >> temp" then I read the words but miss the '\n' character. I need to know about the words because I need to print my text in 80 columns. In other words, I used fin >> temp to say
if ( (myLine + temp).length() > 79 ) // Then make a new node and copy the word into thew new node
then I send the word in temp to next line. So I need to know both about my words as well as my end of line. I know it's probably hard to understand but to put it simple, how could I use fin >> temp to keep the integrity of the words and use getline(fin, temp, '\n') to know about my paragraphs.
Thank you very much.