Have a look at file IO: http://www.cplusplus.com/doc/tutorial/files/
and the srand function, for pseudorandom numbers.
Get the number of lines in the file, get a random number that is within that number of lines, and extract the given line based on the number using the filestream pointer.