hello
Im making a card game using arrays to setup the deck and produce cards. i've got everything done except for scoring both the players hand and dealers hand, to see who wins. I dont know how I would setup an if statement for seeing what you have in a hand once all cards are flipped.
this is what I have so far for dealing the cards and scoring the hand:
Code:void shuffle(int wdeck[][13]) { int row; int column; int card; for(card = 1; card <= 52; card++) { do { row = rand() % 4; column = rand() % 13; }while(wdeck [row] [column] !=0); wdeck [row] [column] = card; } } void deal2(const int wdeck[][13], const char *wface[], const char *wsuit[]) { int card; int row; int column; for ( card = 1; card <= 2; card++ ) { for ( row = 0; row <= 3; row++ ){ for ( column = 0; column <=12; column++ ){ if ( wdeck[row][column] == card ) { printf("%5s%-8s%\n", wface[column], wsuit[row], card % 52 == 0 ); } } } } } void dealcommunity(const int wdeck[][13], const char *wface[], const char *wsuit[]) { int card; int row; int column; for ( card = 3; card <= 3; card++ ) { for ( row = 0; row <= 3; row++ ){ for ( column = 0; column <=12; column++ ){ if ( wdeck[row][column] == card ) { printf("%5s%-8s%\n", wface[column], wsuit[row], card % 52 == 0 ); } } } } } void dealcommunity2(const int wdeck[][13], const char *wface[], const char *wsuit[]) { int card; int row; int column; for ( card = 3; card <= 4; card++ ) { for ( row = 0; row <= 3; row++ ){ for ( column = 0; column <=12; column++ ){ if ( wdeck[row][column] == card ) { printf("%5s%-8s%\n", wface[column], wsuit[row], card % 52 == 0 ); } } } } } void dealcommunity3(const int wdeck[][13], const char *wface[], const char *wsuit[]) { int card; int row; int column; for ( card = 3; card <= 5; card++ ) { for ( row = 0; row <= 3; row++ ){ for ( column = 0; column <=12; column++ ){ if ( wdeck[row][column] == card ) { printf("%5s%-8s%\n", wface[column], wsuit[row], card % 52 == 0 ); } } } } } void dealdealer( const int wdeck[][13], const char *wface[],const char *wsuit[]) { int dcard; int drow; int dcolumn; for ( dcard = 6; dcard <= 7; dcard++ ) { for ( drow = 0; drow <= 3; drow++ ){ for ( dcolumn = 0; dcolumn <=12; dcolumn++ ){ if ( wdeck[drow][dcolumn] == dcard ) { printf("%5s%-8s%\n", wface[dcolumn], wsuit[drow], dcard % 52 == 0 ); } } } } } void playerhandscore(int& playerpoint) { if()//An Ace-High straight of one suit. { cout<<"You have a Royal Flush\n"; playerpoint=9; } if()//A straight of entirely one suit. { cout<<"You have a Straight Flush\n"; playerpoint=8; } if()//Four cards of the same rank { cout<<"You have Four of a Kind\n"; playerpoint=7; } if()//Three-of-a-kind and a pair. { cout<<"You have a Full House"; playerpoint=6; } if()//Five cards of the same suit. { cout<<"You have a Flush\n"; playerpoint=5; } if()//Five cards of sequential rank { cout<<"You have a Straight\n"; playerpoint=4; } if()//Three cards of the same rank { cout<<"You have Three of a Kind\n"; playerpoint=3; } if()//Two cards of the same rank and another two cards of the same rank. { cout<<"You have Two Pair\n"; playerpoint=2; } if()//Two cards of the same rank. { cout<<"You have a Pair\n"; playerpoint=1; } if()//When you don't have any of the above, your highest card determines your hand. { cout<<"You have the High card\n"; playerpoint=1; } } void dplayerhandscore(int& dplayerpoint) { if()//An Ace-High straight of one suit. { cout<<"You have a Royal Flush\n"; dplayerpoint=9; } if()//A straight of entirely one suit. { cout<<"You have a Straight Flush\n"; dplayerpoint=8; } if()//Four cards of the same rank { cout<<"You have Four of a Kind\n"; dplayerpoint=7; } if()//Three-of-a-kind and a pair. { cout<<"You have a Full House"; dplayerpoint=6; } if()//Five cards of the same suit. { cout<<"You have a Flush\n"; dplayerpoint=5; } if()//Five cards of sequential rank { cout<<"You have a Straight\n"; dplayerpoint=4; } if()//Three cards of the same rank { cout<<"You have Three of a Kind\n"; dplayerpoint=3; } if()//Two cards of the same rank and another two cards of the same rank. { cout<<"You have Two Pair\n"; dplayerpoint=2; } if()//Two cards of the same rank. { cout<<"You have a Pair\n"; dplayerpoint=1; } if()//When you don't have any of the above, your highest card determines your hand. { cout<<"You have the High card\n"; dplayerpoint=1; } }