Search code examples
c++classpoker

Classes and implementing them


So I am having some trouble with programming. I have a project that my professor wants us to make a poker game. We are supposed to have a Card class with public members: Constructer,ShuffleCard, GetCard(), and Thirteen void functions to display cards.

also Private members: A deck of cards, and NextCard.

I am having trouble figuring out what needs to be in the class along with creating the program. :( Do not write it for me, I just am SOL and I am not able to find a tutor who will help me with this so I have turned to my only source, the internet. Please don't call me stupid.


Solution

  • Here is a code snippet to get an idea . Happy coding:

    enum suit_t {DIAMOND,SPADE,CLUB,HEART};
    enum power_t {ACE=1,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN,JACK,QUEEN,KING};
    
    
    struct card_t
    {
        suit_t suit_;
        power_t power_;
    };
    
    class deck
    {
    
    private:
        card_t card_[52];
    
    public:
        deck();
        void shuffle();
        card_t get_card() const;
        card_t next_card();
        void display(power_t power, suit_t suit);
    };