Answer to Question #71071 in C++ for MARK ANDREWS
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?
std::ifstream fin("somefile.txt", std::ios::read);
size_t s1 = rand() % stringArray.size();
size_t s2 = rand() % stringArray.size();
std::cout<< stringArray[s1] << std::endl;
std::cout << stringArray[s2] << std::endl;
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Dear MARK ANDREWS,
You're welcome. We are glad to be helpful.
If you liked our service please press like-button beside answer field. Thank you!