Hey guys :) i'm new at programming in C++ and i'm stuck at an assignment that im suppose to write
I need to Write a string function that gets a word at random from a file and returns it as the value of the function. It should use a random number generator to get a random number in the range 1 to number of words in the file, then open the file and read in that many words and then return the last word that was read in.
the file is composed of an integer on top that says how many words that are in the file and the same integer is the max range for the random generator that will tell the string function how many words to read in .
I know how to make the number generator but I'm not sure how to make the string function read in the words
an example of the txt file
6
amadeus
toupet
kiley
liope
limouri
getsuga
can only use fstream , iostream libraries
and no arrays :(
i hope someone can help me ... thank you :)