I have a list of about 500 names in a text file, i want to be able to get 5 random winners from this file. using C++ how do i do this

Read each name into a string and assign to a vector of strings.

Get the size of the vector and create a random number in the range 0 - (size-1). Record it.
Repeat 4 more times throwing away any duplicates of entries already selected.
Output the names corresponding to the 5 numbers that have been generated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.