S
sahm
hi,
i have to create a program that will print the 52 cards in a deck using
the overloaded ostream operator. it worked fine....then i hve to create
a function that will print the cards in hand in random(5, 10).
//error it shld only have two parameters
ostream& operator<<(ostream& out, vector<Card>& deck2, vector<Card>&
hand)
{
for(unsigned int i = 0; i < hand.size(); i++)
{
int random;
random = randNum(0, 51);
//if the card is picked, don't add it in
hand,instead add another card/s in the vector
if(deck2[random].isPicked())
{
deck2[random].printCard(out);
out << 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 = deck2[random];
deck2[random].setPicked(true);
hand.printCard(out);
out << endl;
}
}
return out;
}
what shld i put in the parameters of ostream& operator<<(..) in order
to print the card in hand
i have to create a program that will print the 52 cards in a deck using
the overloaded ostream operator. it worked fine....then i hve to create
a function that will print the cards in hand in random(5, 10).
//error it shld only have two parameters
ostream& operator<<(ostream& out, vector<Card>& deck2, vector<Card>&
hand)
{
for(unsigned int i = 0; i < hand.size(); i++)
{
int random;
random = randNum(0, 51);
//if the card is picked, don't add it in
hand,instead add another card/s in the vector
if(deck2[random].isPicked())
{
deck2[random].printCard(out);
out << 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 = deck2[random];
deck2[random].setPicked(true);
hand.printCard(out);
out << endl;
}
}
return out;
}
what shld i put in the parameters of ostream& operator<<(..) in order
to print the card in hand