making my card dealing program deal 5 cards a determine what hand it is

im new to programming im in programming one. i have my code for a card shuffling program. bUT our teacher wants us to modify the programs we coded and make it deal 5 cards and then determine what kind of hand it is. I believe i have to change my function. I normally wont ask for help so bluntly because this is how u learn but my teacher doesnt teach us or even help a little bit she answers our questions with questions and she makes us feel dumb which for wht im payin and every1 else is crap.i've had my head in my text book for 5 hours now.. no lie and i still dont understand.. i need to leave the library cause its about to close i dont have internet at my house and i need to have this done by tomorrow morning cause i have to use it to do my final(lord alone knows what that may bring).. im gonna paste my code in here if anyone can help me please!! i even think somthin is wrong with my card dealing program because some of it prints null of jacks instead of what it really is

//Card shuffling dealing program

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

//prototypes
void shuffle(int wDeck[][ 13 ] );
void deal( const int wDeck[][ 13 ], const char *wFace[],
const char *wSuit[] );

int main(void)
{
//initialize suit array
const char *suit[ 4 ] = { "Hearts", "Diamonds", "Clubs", "Spades" };

//initialize face array
const char *face[ 13 ] =
{ "Ace", "Deuce", "Three"
"Five", "Six", "Seven", "Eight",
"Nine", "Ten", "Jack", "Queen", "King" };

//initialize deck array
int deck[ 4 ][ 13 ] = { 0 };

srand( time(0) );//seed random-numbre generator

shuffle( deck );
deal( deck, face, suit );

printf("\n\n");

system("PAUSE");
return 0;//determines successful termination

}//end function main

//shuffle cards in deck
void shuffle( int wDeck[][ 13 ] )
{
int row;//row number
int column;//column number
int card;//countre

//for each of the 52 cards, choose slot of deck randomly
for ( card = 1; card <= 52; card++ )
{
//choose new random location until unoccupied slot found
do {
row = rand() % 4;
column = rand() % 13;
} while( wDeck[ row ][ column ] != 0 );//end do... while

//place card number in chosen slot of deck
wDeck[ row ][ column ] = card;
}//end for

}//end function shuffle

//deal cards in deck
void deal( const int wDeck[][ 13 ], const char *wFace[],
const char *wSuit[] )
{
int card;//card counter
int row;//row counter
int column;//column counter

//deal each of the 52 cards
for ( card = 1; card <= 52; card++ )
{//loop through rows of wDeck
for ( row = 0; row <= 3; row++ )
{//loop through columns of wDeck for current row
for ( column = 0; column <= 12; column++ )
{//if slot contains current card, display card
if( wDeck[ row ][ column ] == card ) {
printf( "\n\n%5s of \n%-8s%c", wFace[ column ], wSuit[ row ],
card % 2 == 0? '\n' : 't');
}//end if
}//end for
}//end for
}//end for
}//end function deal
You forgot the "four" in the const char face array ( About 15 lines down )

I tested it with the added four and I got no nulls.
Last edited on
thank you : ).. i figured out how to get it to deal five cards. can u help me detrmine what kind of hand it is?
Topic archived. No new replies allowed.