Help…I’m trying to create a poker game but not with the standard shuffle. I have to hard code what cards I want. Then write functions to accomplish each of the following:
Determine if the hand contains: a pair, two pairs, three of a kind, and so forth.
Any help would be appreciated.
Code:
#include <iostream>
using std::cout;
using std::ios;
#include <iomanip>
using std::setw;
using std::setiosflags;
#include <cstdlib>
void deal ( const int [] [13], const char *[], const char *[] );
int main()
{
const char *suit[ 4 ] = //Initialize the suit array
{" Hearts", " Diamonds","Clubs", " Spades"};
const char *face[ 13 ] = //Initialize the face array
{"Ace ", "Deuce ", "Three ", "Four ",
"Five ", "Six ", "Seven ", "Eight ",
"Nine ", "Ten ", "Jack ", "Queen ", "King "};
int deck[ 4 ][ 13 ] = {0,0,2,3,4} ; //Initialize the deck array
deal (deck, face, suit);
return 0;
}
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 (10) << setiosflags (ios::right)
<< wFace [column] << "of"
<< setw (8) <<setiosflags (ios::left)
<< wSuit[row]
<< ( card % 1 == 0 ? '\n' : '\t' );
}