updating a card deck

Hi

I was wondering how I would update the sum when a random card is drawn in my program.

So far I have a few ideas in mind.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int player = 0;
int dealer = rand()%9 + 16;
int card1=rand()%11+1, card2=rand()%11+1, card3=rand()%11+1;
char choice;
cout<<"You have been dealt a "<<card1<<" and a"<< card2;
cout<<"The sum is "<<player; //would I put player? How would I sum the cards.
cout<<"Would you like to hit or stay?";
cin>>choice;

if(choice=='h'||choice=='H')
{
   cout<<" You have been drawn a "<<card 3;
   cout<<" The sum is "<<//???;
}



keep in mind that the player can hit as many times as they want as long as the sum does not go over 21. I am interested in knowing if there is any way that I can update the random cards being drawn without declaring a bunch of cards.
Could you explain a little bit more what you want to do ??. Apparently you need to use an array for your cards.
Topic archived. No new replies allowed.