/************************************************** ** bridge.cpp ** ** please note that card rank 10 is defined as T ** **************************************************/ #include using namespace std; const int hand=13; const int deckSize=52; int shuffle(int a[ ]) { srand(time(NULL)); for(int l=0; l38) { clubs = clubs + convertRank(a[n]) + " "; } else if ((a[n]>12) && (a[n]<26)) { hearts = hearts + convertRank(a[n]) + " "; } else if ((a[n]>25) && (a[n]<39)) { diamonds = diamonds + convertRank(a[n]) + " "; } } cout << "\nSpades: " << spades << endl; cout << "Hearts: " << hearts << endl; cout << "Clubs: " << clubs << endl; cout << "Diamonds: " << diamonds << endl; } int count(int a[ ]){ int total=0; for(int u=0; u x) && (w > y) && (w > z)){ cout << "Hand 1 is the winner!" << endl; } else if ((x > w) && (x > y) && (x > z)){ cout << "Hand 2 is the winner!" << endl; } else if ((y > w) && (y > w) && (y > z)){ cout << "Hand 3 is the winner!" << endl; } else if ((z > w) && (z > x) && (z > y)){ cout << "Hand 4 is the winner!" << endl; } else { cout << "There is no clear winner please try again" << endl; } } int main( ) { int hand1total=0, hand2total=0, hand3total=0, hand4total=0; int deck[deckSize] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51 }; shuffle(deck); int *hand1, *hand2, *hand3, *hand4; hand1 = &deck[0]; hand2 = &deck[14]; hand3 = &deck[27]; hand4 = &deck[40]; //output cout << "Hand 1: " << endl; intoSuit(hand1); hand1total = count(hand1); cout << "Hand 1 total is: " << hand1total << " points." << endl; cout << "\nHand 2: " << endl; intoSuit(hand2); hand2total = count(hand2); cout << "Hand 2 total is: " << hand2total << " points." << endl; cout << "\nHand 3: " << endl; intoSuit(hand3); hand3total = count(hand3); cout << "Hand 3 total is: " << hand3total << " points." << endl; cout << "\nHand 4: " << endl; intoSuit(hand4); hand4total = count(hand4); cout << "Hand 4 total is: " << hand4total << " points." << endl; defineWinner(hand1total,hand2total,hand3total,hand4total); system("pause"); return 0; }