i have this program that i need to complete but i cant seem to figure it out. i have to create teh program to deal 5 cards(which it does that) and then it has to disply these fowlling things:
-determine if the hand contains a pair
-determine if the hand contains two pairs
-determine if the hand contains three of a kind
-determine if the hand contains four of a kind
-determine if the hand contains a flush
-determine if the hand contains a straight
heres the code if your guys could greatly help me out i would appreciate it im so confused!!!
#include<iostream.h>
#include<iomanip.h>
#include<stdlib.h>
#include<time.h>
void shuffle(int [] [ 13 ]);
void deal(const int [] [ 13 ], const char *[], const char *[]);
int main()
{
const char *suit[ 4 ] =
{"hearts", "diamonds", "clubs", "spades" };
const char *face[ 13] =
{"ace", "deuce", "three", "four", "five", "six",
"seven", "eight", "nine", "ten", "jack", "queen", "king"};
int deck[4][13] = {0};
srand(time(0));
shuffle(deck);
deal(deck, face, suit);
return 0;
}
void shuffle(int wDeck[] [13])
{
int row, column;
for (int card = 1; card <= 5; card++){
do {
row = rand() % 4;
column = rand() % 13;
} while (wDeck[row][column] !=0);
wDeck[row][column] = card;
}
}
void deal (const int wDeck[] [13], const char *wFace[],
const char *wSuit[])
{
for (int card = 1; card <= 5; card++)
for (int row = 0; row <=3; row++)
for (int column = 0; column <= 12; column++)
if (wDeck[row][column] == card){
cout<<setw(4)<<setiosflags(ios::right)
<<wFace[column]<<" of "
<<setw(8)<<setiosflags(ios::left)
<<wSuit[row]
<<(card % 2 == 0 ? '\n' : '\t')<<endl;
}
}