Hi
How do I read a list of names from a file- into an array of strings. Once I have the array - h ow do I use a random number generator to shuffle the order and pick 2 students at a time?
As variant it can be done as follows
std::string name;
std::vector<std::string> stringArray;
std::ifstream fin("somefile.txt", std::ios::read);
std::getline (fin,name);
stringArray.push_back(name);
size_t s1 = rand() % stringArray.size();
size_t s2 = rand() % stringArray.size();
std::cout<< stringArray[s1] << std::endl;
std::cout << stringArray[s2] << std::endl;