#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
const char CARDS[] = { 'K', 'Q', 'J'};
unsigned const CARDS_SIZE = sizeof(CARDS)/sizeof(char);
void printCards(std::vector<const char*>& cards);
int main()
{
srand(time(0));
std::vector<const char*> pCards;
for ( unsigned i = 0; i < CARDS_SIZE; ++i)
{
pCards.push_back(&CARDS[i]);
}
for ( unsigned i =0 ; i < 5; ++i)
{
std::random_shuffle(pCards.begin(), pCards.end());
printCards(pCards);
}
return 0;
}
void printCards(std::vector<const char*>& cards)
{
std::vector<const char*>::iterator it;
for ( it = cards.begin(); it != cards.end(); ++it)
{
std::cout << **it << " ";
}
std::cout << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3RpbWU+Cgpjb25zdCBjaGFyIENBUkRTW10gPSB7ICdLJywgJ1EnLCAnSid9OwoKdW5zaWduZWQgY29uc3QgQ0FSRFNfU0laRSA9ICBzaXplb2YoQ0FSRFMpL3NpemVvZihjaGFyKTsKCnZvaWQgcHJpbnRDYXJkcyhzdGQ6OnZlY3Rvcjxjb25zdCBjaGFyKj4mIGNhcmRzKTsKCmludCBtYWluKCkKewogICAgc3JhbmQodGltZSgwKSk7CiAgICBzdGQ6OnZlY3Rvcjxjb25zdCBjaGFyKj4gcENhcmRzOwogICAgCiAgICBmb3IgKCB1bnNpZ25lZCBpID0gMDsgaSA8IENBUkRTX1NJWkU7ICsraSkKICAgIHsKICAgICAgICBwQ2FyZHMucHVzaF9iYWNrKCZDQVJEU1tpXSk7CiAgICB9CiAgICBmb3IgKCB1bnNpZ25lZCBpID0wIDsgaSA8IDU7ICsraSkKICAgIHsKICAgICAgICBzdGQ6OnJhbmRvbV9zaHVmZmxlKHBDYXJkcy5iZWdpbigpLCBwQ2FyZHMuZW5kKCkpOwogICAgICAgIHByaW50Q2FyZHMocENhcmRzKTsKICAgIH0KICAgIAog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