How would i "name" the cards in the array using a switch statement( such as King of Hearts, 4 of Spades etc.)? How would I actually show them the cards i dealt out, this is only my 3rd week of class. Please help. All this program is supposed to do is make a simple poker game w/ no straights or flushes.
#include <iostream.h>
#include <string.h>
#include <ctype.h>
const int PLAYERNUM=2;
void shuffle (int wDeck [4][13]);
void deal (int wDeck[4][13], int wHand[PLAYERNUM][4][13]);
void main ()
{
#define PLAYERNUM 2
int deck[4][13]={0};
int player;
int hand[PLAYERNUM][4][13]={0};
char s, d;
cout<<"Welcome to five card poker with no straights or flushes. "<<endl;
cout<<"Press s to shuffle"<<endl;
cin>>s;
shuffle(deck);
cout<<"Press d to deal the cards"<<endl;
cin>>d;
deal (deck, hand );
cout<<"player one, your cards are"<<endl;
//dont know what else to do here
return;
}
void shuffle (int wDeck [4][13])
{
int cardnum, row, column;
for (cardnum=1; cardnum<=52; cardnum++)
{
row=rand()%4;
column=rand()%13;
while (wDeck[row][column]!=0)
{
row=rand()%4;
column=rand()%13;
}
wDeck[row][column]=cardnum;
}
}
void deal (int wDeck[4][13], int wHand[PLAYERNUM][4][13])
{
int cardnum, row, column, firstCard=1, lastCard=5, flag=0;
for (int hand=0; hand<PLAYERNUM; hand++)
{
for (cardnum=firstCard; cardnum<=lastCard; cardnum++)
{
for (column=0; column<13; column++)
{
if (wDeck[row][column]==wDeck[row][column])
{
wHand[hand][row][column]=wDeck[row][column];
flag=1;
break;
}
}
if (flag==1)
{
flag=0;
break;
}
}
firstCard+=5;
lastCard+=5;
}
return;
}