//bridge.cpp #include using namespace std; const int hand=13; int main( ) { int q; enum suit_t{ SPADES, CLUBS, DIAMONDS, HEARTS, NUM_SUITS }; enum rank_t { ACE=1, TWO=2, THREE=3, FOUR=4, FIVE=5, SIX=6, SEVEN=7, EIGHT=8, NINE=9, TEN=10, JACK=11, QUEEN=12, KING=13, NUM_RANK=14 }; typedef struct _card { suit_t suit; rank_t rank; } card; card deck[52], hand1[13], hand2[13], hand3[13], hand4[13]; int d=0; for(int i=0; i< NUM_SUITS; i++) { for(int j=1; j< NUM_RANK; j++) { deck[d].suit = suit_t(i); deck[d].rank = rank_t(j); d++; } } srand(time(NULL)); for(int l=0; l<52; l++) { int m= rand() % (52-l); card tmp=deck[l]; deck[l]=deck[l+m]; deck[l+m]=tmp; } for(int n=0;n<=12;n++){ hand1[n] = deck[n]; } q=0; for(int n=13;n<=25;n++){ hand2[q] = deck[n]; q++; } q=0; for(int n=26;n<=38;n++){ hand3[q] = deck[n]; q++; } q=0; for(int n=39;n<=51;n++){ hand4[q] = deck[n]; q++; } int hand1total = 0; cout << "hand 1: " << endl; for(int u=0; u