I have a problem figuring out how I would be able to do this. The problem is that I need to search for a word and store what lines that word appears in in a vector, and I have to do this for every word in the textfile. SO let's say I'm searching for the string "week" it appears once in line 1 and twice in line 10. The array for that word should have {1,10, 10} This is my idea of it
the following is pseudocode:
1 2 3 4 5 6 7 8
while(line>>word)
{
search word;
if word not found! cout<<"not here";
if found( vector.push(line_number);
}
line_number++;