24.13 PLAYING CARDS

Class card needs following declaration:

enum Suit { Spade, Heart, Diamond, Club };

const int FiftyTwo = 52 ;

class Card

    { private :      int n ; // 0 to 51      int val ; // 0 to 12      Suit suit; // 0    public:      Card ();      void init( int num) ;      void show() ;  };

class Deck

    { private :      Card crd[FiftyTwo];    public:      Deck() ;      void shuffle();  };

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.