#include #include #include enum SuitType { Hearts,Clubs,Spades,Diamonds}; enum ValueType {two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace}; struct card { SuitType Suit; ValueType Value; }; class Deck { public: Deck ( ); void shuffle ( ); card deal ( ); void swap(int , int ); private: apvector < card > myDeck; }; Deck::Deck() //constructor :myDeck(52) { //-----fill vector----- int index=0; for(SuitType loop1=Hearts;loop1<=Diamonds; loop1++) { for (ValueType loop2=two;loop2<=ace;loop2++) { myDeck[index].Suit=loop1; myDeck[index].Value=loop2; index++; } } } void Deck::shuffle() { RandGen a ; RandGen b; int c,d; for(int loop=0;loop<10000; loop++) { c=a.RandInt(1,52); d=b.RandInt(1,52); swap(c,d); } } void Deck::swap(int a, int b) { apvector temp(1); temp[1]= myDeck[a]; myDeck[a]=myDeck[b]; myDeck[b]=temp[1]; } card Deck::deal () { int abc; RandGen a; abc=a.RandInt(52); return myDeck[abc] ; }