Basically, I'm trying to open a file that has 10 words/ phrases in it. What I want to do is open the file and pull just one of the phrases out(at random). I'm stuck at this point and am not really sure where to go from here.
Any ideas?
Code:#include <iostream> #include <string> #include <fstream> using namespace std; int main () { string random; ifstream inFile; inFile.open("random.dat"); inFile >> random; cout << random << endl; inFile.close(); }