Randomizing string placement in an array

closed account (1b9vC542)
I need to take my string of 6 words, then scramble them into a different order, then output to the console.
string line1[] = {"I", "Can", "Do", "That", "Hold", "My", "Beer"};
You can use std::random_shuffle in the <algorithm> header:

http://www.cplusplus.com/reference/algorithm/random_shuffle/

(Basically, it's just random_shuffle(line1, line1+7); in your case)
Topic archived. No new replies allowed.