Q:

Read words from paragraph to paragraph, from line to line (C++)

I'm looking for a way to read and locate words (line number, paragraph number) from a file. 
For example, I want to track the number of the word "you" in a file. Each time I find this word on a line, I will push the line number and the paragraph number to the two vectors
ifstream file;
file.open(input.txt)
vector<int> paragraph_number;
vector<int> line_number; 

What's the best way to read paragraph by paragraph and line by line? Thank you!

A:

Line number is fairly simple, as you can just use getline or something similar to read one line at a time. Just keep track of the number of times you read a line from the file. Or, you could count the number of newline (\n) you run across. 
Paragraph is a bit trickier, there's no standardized way to look at paragraph in a file. You would probably need some sort of character delimiter for the end of a paragraph. You could interpret two newlines as a new paragraph, but that part is up to you. 

