Hi,
I am trying to define a card class for a card game and am having trouble connecting the values provided to the constructor to some predefined enum types.
If I defined two enum types to be:
And a constructor which took in two chars representing the rank and the suit (because the user would enter it this way via standard input):Code:enum Rank {Two, Three, [..other cards..] Jack, Queen, King, Ace}; enum Suit {Spades, Diamonds, Clubs, Hearts};
Code:Card (Rank r, Suit s);
e.g. Card(J,D) -> Is internally equivalent to Card(Jack, Diamonds)
How do I make that connection?
I am also given:
Any help would be much appreciated!Code:string Card::RankName = "23456789TJQKA"; string Card::SuitName = "SDCH";



LinkBack URL
About LinkBacks


