Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 4. Print a Deck of 52 Cards
- //Write a program that generates and prints all possible cards from a standard deck of 52 cards (without the jokers). The cards should be printed using the classical notation (like 5♠, A♥, 9♣ and K♦). The card faces should start from 2 to A. Print each card face in its four possible suits: clubs, diamonds, hearts and spades.
- //This is variant with arrays
- using System;
- class PrintDeck52CardsVariant
- {
- static void Main()
- {
- //Arrays
- string[] cards = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A" };
- int[] colors = { 3, 4, 5, 6 };
- foreach (var card in cards)
- {
- foreach (var color in colors)
- {
- Console.Write(card);
- Console.Write((char)color + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement