i want to display data randomly from a file

Hello everyone, i have a text file with 15 rows and 2 columns of data that looks like:

1567 B
3209 E
4590 C
3492 D
4920 B

and so on...

i need the program to display each row in a random order.

i have a function that will display all of the data in the current order but i cant figure out how to get it to display in a random order. to display in the current order it looks like this:


void printAllSongInfo (int NUM_SONGS, const songIDList songIDs, const songTypeList songTypes)

{
int count;

cout << "You are now playing the current playlist: " << endl;
cout << "Song ID Number Song Category" << endl;
cout << "============== =============" << endl;


for (count = 0; count < NUM_SONGS; count++)
{
cout << left << setw(6) << songIDs [count] << " ";
printSongType (songTypes [count]);
cout << endl;
}

}


how can i change this to display the data in a random order?
any help appreciated, thanks!





Topic archived. No new replies allowed.