SHOW:
|
|
- or go back to the newest paste.
| 1 | using System; | |
| 2 | using System.Collections.Generic; // not needed | |
| 3 | ||
| 4 | /// <summary> | |
| 5 | /// Write a program that generates and prints all possible cards from a | |
| 6 | /// standard deck of 52 cards (without the jokers). The cards should be | |
| 7 | /// printed using the classical notation (like 5♠, A♥, 9♣ and K♦). The card | |
| 8 | /// faces should start from 2 to A. Print each card face in its four possible | |
| 9 | - | } |
| 9 | + | /// suits: clubs, diamonds, hearts and spades. Use 2 nested for-loops and a |
| 10 | /// switch-case statement. | |
| 11 | /// </summary> | |
| 12 | public class PrintCardDeck | |
| 13 | {
| |
| 14 | static void Main() | |
| 15 | {
| |
| 16 | string[] cards = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A" };
| |
| 17 | char[] suit = { '♠', '♥', '♣', '♦' };
| |
| 18 | for (int i = 0; i < cards.Length; i++) | |
| 19 | {
| |
| 20 | for (int j = 0; j < suit.Length; j++) | |
| 21 | {
| |
| 22 | Console.WriteLine(cards[i] + suit[j]); | |
| 23 | } | |
| 24 | } | |
| 25 | } | |
| 26 | } |