hi,
i created a function
ostream& operator<<(ostream& out, vector<Card>& deck)
{
int i = 0;
for (int s = 1; s <= 4; s++)
{
for (int r = 1; r <= 13; r++, i++)
{
deck[i].setSuit(s);
deck[i].setRank(r);
deck[i].printCard(out);
}
out << endl;
system("pause");
out << endl;
}
return out;
}
//that will print out the ordered deck of cards, i need to create a
function that will overload ostream operator, and that will print out
the cards in the hand in random order(ranges 5 to 15)...
void fillHand(ostream& out, vector<Card>& hand, vector<Card>& deck2)
{
for(unsigned int i = 0; i < hand.size(); i++)
{
int random;
random = randNum(0, 51);
if(deck2[random].isPicked())
{
deck2[random].printCard(out);
cout << endl;
int last = hand.size() - 1;
hand.push_back(hand[last]);
for(int i = last; i > deck2[random].isPicked();
i--)
{
hand[last] = hand[last - 1];
}
}
else
{
hand[i] = deck2[random];
deck2[random].setPicked(true);
hand[i].printCard(out);
cout << endl;
}
}
}
//this worked, but it's not giving me random cards...pls i need help