Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //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. Use 2 nested for-loops and a switch-case statement.
- class PrintDeckof52Cards
- {
- static void Main()
- {
- for (int i = 2; i <= 14; i++)
- {
- if (i == 11)
- {
- Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", 'J' + "" + (char)5, 'J' + "" + (char)3, 'J' + "" + (char)4, 'J' + "" + (char)6);
- }
- if (i == 12)
- {
- Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", 'Q' + "" + (char)5, 'Q' + "" + (char)3, 'Q' + "" + (char)4, 'Q' + "" + (char)6);
- }
- if (i == 13)
- {
- Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", 'K' + "" + (char)5, 'K' + "" + (char)3, 'K' + "" + (char)4, 'K' + "" + (char)6);
- }
- if (i == 14)
- {
- Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", 'A' + "" + (char)5, 'A' + "" + (char)3, 'A' + "" + (char)4, 'A' + "" + (char)6);
- }
- if (i>=2 && i<=10)
- {
- Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", i + "" + (char)5, i + "" + (char)3, i + "" + (char)4, i + "" + (char)6);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement