Keeping track of values while dealing cards

Hello, I am trying to create a program to run a simple blackjack game that runs a series of hands by itself. The problem that I am having is that I can deal the cards with suit, but I can't figure out how to keep track of the values for the dealers cards and the players cards separately. When the cards are dealt, I convert '1' into 'A', '11' into 'J', etc. for Queen and king, and also 1 into hearts, through 4 with the rest. Also, J,Q,K are all equal to 10.

So, basically I cannot figure out how to keep track of the running values. The extent of my programming knowledge goes to while, do while, for loops, and simple functions. Also, I don't want the code for this, I just want someone to point me in the right direction because I would like to figure it out mostly on my own. Any help is appreciated.
I would like to help you but I am confused at what you're asking. what do you mean by "running values", do you want to keep track of the card's dealt? or do you want to keep track of the value's of the dealt card's?
You need to have a list of cards available, and for each player you need a list of cards dealt.

An excerpt from my own Blackjack card class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//----------------------------------------------------------------------------
// Card class
//   A card represents four things:
//    - an integer index in 0..52
//    - a suit in 0..13
//    - a face in Spades..Hearts
//    - an integer BlackJack game value
//   A suit/value of zero is the Joker (unused in this program)
//
const char* SuitNames[] =
  {
  "Joker", "Ace",   "Two",  "Three", "Four", "Five",  "Six",
  "Seven", "Eight", "Nine", "Ten",   "Jack", "Queen", "King"
  };

const int SuitValue[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 };
enum Suit
  {
  Joker   =  0,
  Ace     =  1,
  Jack    = 11,
  Queen   = 12,
  King    = 13,
  SoftAce = 11
  };

const char* FaceNames[] = { "Spades", "Diamonds", "Clubs", "Hearts" };
enum        Face          {  Spades,   Diamonds,   Clubs,   Hearts  };

//............................................................................
struct Card
  {
  Face face;
  Suit suit;

  Card( int index = Joker ):
    face( (Face)( (index != Joker) ?  ((index -1) /13)     : Spades ) ),
    suit( (Suit)( (index != Joker) ? (((index -1) %13) +1) : Joker  ) )
    { }
  Card( int suit, int face ):
    face( (Face)face ),
    suit( (Suit)suit )
    { }
  inline int value()    const { return SuitValue[ suit ]; }
  inline operator int() const { return SuitValue[ suit ]; }
  inline bool ace()     const { return suit == Ace;       }
  inline int  index()   const { return (face *13) +suit;  }
  };

Now all I need is a list of 52 integers (in [1, 13] × 4) per deck. Then all I need to do is shuffle them and "deal" one to each player.

The number can be turned into a Card using the class above.

Make sense?
Topic archived. No new replies allowed.