random words from text document
Hello. I was wondering how you would gererate a random word from a text document.
I have tryed this
1 2 3 4 5 6 7 8
|
string startWord;
string getlin;
ifstream startWor;
startWor.open("words.txt");
startWor >>(startWord);
cout<<startWord[rand() % 5];
|
It doesnt seem to be working though. Any advice?
Topic archived. No new replies allowed.