First - declare a counter variable and set it to zero.
Second - use a while loop with a getline call as your loop condition.
Third - increment the counter variable.
Fourth - see if the word you are looking for is in that line.
Fifth - If it is return the counter variable or if you want to see the entire line the word was found it return that.
Sixth - If not keep the loop going.
NathanOliver
Veteran Poster
1,084 posts since Apr 2009
Reputation Points: 215
Solved Threads: 189