If i understand correcly you want to get the text of a line from a txt file eh?
Well what i would do in vb:
Put the text file in a string...
Find how many lines the text file has so i can have a random number from 1 to the lines of the file.
Then use split() on the string that has the text and in the ()s put the random generated number
And get the final result.
Hopes this helps you!
Good luck
Btw i posted what i would do in vb, not in C++...