Ok, so an overview is (I'm assuming 5 card draw poker here?):
-Set up a shuffle for the cards. You could do this by randomly swapping elements in the array using rand() from <cstdlib>. (1)
-Deal out the hands. (2)
-Prompt players for bets (3)
-Prompt the player for which cards they want to change (4)
-Deal out the next cards (5)
-Prompt players for best (3)
-Prompt the player for which cards to change again (4)
-Deal out the card again (5)
-Evaluate the hand values (6)
-Reward the winner with monies (7)
Each number in brackets can be a separate function. Then you will end up with a main that looks mostly like this:
1 2 3 4 5 6 7 8 9 10 11
|
int main()
{
//Welcome to the game
while(true) //Game loop
{
//Lots of function calls
//Some kind of break condition
//e.g. When player goes bankrupt
}
return 0;
}
|
Let me know if you're stuck on any aspect in particular and I'll try to help out. note also you have some problems in your above code and might want to review it.
1 2 3 4 5 6 7
|
int num = rand()%52;//Why?
while (deck[num]==1); //You initialized all elements of deck to 0...
{
num=rand()%52;
phand[x]=num;
}
|