I have run into a small snag in a blackjack program I'm making. I used to know the answer but a 2 year leave of programming absence has left me bereft of the answer.
I send a vector to a deal function (whose code I will include below) in the function it appears as though the vetor is properly filled, but upon leaving the function, it erm, loses all of it's new memory except in the first cell. Any ideas
here's the delenquint function
void Deck::deal(vector<card> &hand, int num)
{
hand.resize(num);
int size = hand.size();
card hold;
int s, f;
for(int i=0; i<num; i++)
{
s= rand()%4;
f= rand()%12+1;
while(used[s][f] > decknum)
{
s= rand()%4;
f= rand()%12+1;
}
hand[i].face = f;
hand[i].suit = s;
hold = hand[i];
}
}