I would like to know how it is possible for me to do the following:
1)Enter at least 5 words (I am using strings)
2)Store them in a vector
3)Make another vector that stores randomly between 1 to 3 of the words stored in the string.
4)Randomly Shuffles the words.
1.) Have some constant that defines the minimum number of words required, for example constint min_number_of_words = 5;.
2.) Enter a loop which the user can terminate at any time if they enter some message like "quit" or "exit", however, if they've typed less than min_number_of_words words, they cannot terminate the loop prematurely. Every time they enter a name you push_back() their entry onto a vector of strings (let's call it 'words'). std::vector<std::string> words;
You can check to see how many entries exist in the vector by calling its size() method. Naturally, a "quit" message should not be pushed onto the vector.
3.) Define another variable such as number_of_words and assign to it a pseudo-random number between one and three inclusive.
4.) Shuffle the 'words' vector.
5.) Create another vector of strings, enter a for loop which terminates when a counter variable (let's call it 'n') is less than number_of_words.
6.) For each iteration of the loop, push_back the n'th element from 'words' to our new vector.