Example: Shuffling Cards

To illustrate a number of built-in functions, this example initializes, shuffles, and displays the playing cards in a standard deck.

Initialize the Deck

There are many ways to represent a deck of cards but this program uses an array of 52 Integers. The values 2 through 10 indicate deuce through 10. The values 11 through 14 represent jack, queen, king, and ace. If the suit is clubs, add 100. The three of clubs is therefore 103. For diamonds, hearts, and spades, add 200, 300, and 400, respectively. Are you ready to start? Follow these steps:

  1. Launch Visual Studio .NET and create a new Windows Application project named Shuffle.

  2. Set the Text property of the default form to Shuffle Cards.

  3. Add three buttons and a list box to the ...

Get Faster Smarter Beginning Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.