1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include <vector>
#include <iostream>
#include <algorithm>
#include <string>
void TestVector2(void)
{
static const std::string initStrings[] = {
"a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"
};
std::vector<std::string> strings;
strings.assign(initStrings, initStrings+ARRAYSIZE(initStrings));
std::random_shuffle(strings.begin(), strings.end());
std::vector<std::string>::iterator it, itEnd;
itEnd = strings.end();
for(it=strings.begin() ; it!=itEnd ; ++it)
std::cout << *it << std::endl;
} |
Partager