A
A_StClaire_
dudes,
say I have a Hand object named X and feed it into the function below.
how do I code it so the message "Dealing card to X..." comes up?
'cause I know the way it is now doesn't work.
void random_deal(Hand& H) {
srand((unsigned)time(0));
cout << "Dealing card to " << H << "...";
cin.get();
int random_int = 0;
int lowest = 0;
int highest = 51;
int range = highest - lowest + 1;
for(int index = 0; index < 20; index++) {
random_int = lowest + (range * rand() /
(RAND_MAX + 1));
}
vector <Card>::iterator pos = cards_in_deck.begin();
pos += random_int;
H.cards_in_hand.push_back(*pos);
cards_in_deck.erase(pos);
}
thx a lot
say I have a Hand object named X and feed it into the function below.
how do I code it so the message "Dealing card to X..." comes up?
'cause I know the way it is now doesn't work.
void random_deal(Hand& H) {
srand((unsigned)time(0));
cout << "Dealing card to " << H << "...";
cin.get();
int random_int = 0;
int lowest = 0;
int highest = 51;
int range = highest - lowest + 1;
for(int index = 0; index < 20; index++) {
random_int = lowest + (range * rand() /
(RAND_MAX + 1));
}
vector <Card>::iterator pos = cards_in_deck.begin();
pos += random_int;
H.cards_in_hand.push_back(*pos);
cards_in_deck.erase(pos);
}
thx a lot