Question: write a two card poker game, the user and the computer will get two cards, cards are an integer value between 2-14 and are printed

 


write a two card poker game, the user and the computer will get two cards, cards are an integer value between 2-14 and are printed out as 2,3,4,5,6,7,8,9,10,J,Q,K,A.

the winner is when: if both players have a pair then the pair with the highest numerical value wins, if only one player has a pair, then the pair wins, if neither the players has a pair, then the player with the highest card wins, if both players highest card is the same, then the winner goes to the player with the second highest card, tie: if both have the exact same cards, it is a tie


output:

[K] [9] Your cards

[Q] [5] Computer's cards

You win

Want to play again? (Y/N) y

[7] [2] Your cards

[10] [5] Computer's cards

You lose

Want to play again? (Y/N) ......





Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!