Здравейте! Някакви насоки за тази задача? Имам трудност с буквите.
Print Deck of Cards
Description
Write a program that reads a card sign(as a string ) from the console and generates and prints all possible cards from a standard deck of 52 cards up to the card with the given sign(without the jokers). The cards should be printed using the classical notation (like 5 of spades, A of hearts, 9 of clubs; and K of diamonds).
- The card faces should start from 2 to A ( 10 is 10).
- Print each card face in its four possible suits: clubs , diamonds , hearts and spades .
Input
- On the only line, you will receive the sign of the card to which, including, you should print the cards in the deck.
Output
- The output should follow the format bellow(assume our input is
5
):
2 of spades, 2 of clubs, 2 of hearts, 2 of diamonds
3 of spades, 3 of clubs, 3 of hearts, 3 of diamonds
...
5 of spades, 5 of clubs, 5 of hearts, 5 of diamonds
Constraints
- The input character will always be a valid card sign.
Sample tests
Input | Output |
---|---|
5 | 2 of spades, 2 of clubs, 2 of hearts, 2 of diamonds |
3 of spades, 3 of clubs, 3 of hearts, 3 of diamonds
…
5 of spades, 5 of clubs, 5 of hearts, 5 of diamonds|
string cards = Console.ReadLine();
int x = int.Parse(cards);
x = 14;
char eleven = Convert.ToChar(74);
char twelve = Convert.ToChar(75);
char thirteen = Convert.ToChar(81);
char fourteen = Convert.ToChar(65);
for (int i = 2; i < 14; i++)
{
if (i < 11)
{
Console.WriteLine($"{i}" + " of clubs, " + $"{i}" + " of hearts, " + $"{i}" + " of diamonds, " + $"{i}" + " of spades ");
}
else if (i > 10 && i < 15)
{
if (i == 11)
{
Console.WriteLine($"{eleven}" + " of clubs, " + $"{eleven}" + " of hearts, " + $"{eleven}" + " of diamonds, " + $"{eleven}" + " of spades ");
}
}
else if (i > 10 && i < 15)
{
if (i == 12)
{
Console.WriteLine($"{twelve}" + " of clubs, " + $"{twelve}" + " of hearts, " + $"{twelve}" + " of diamonds, " + $"{twelve}" + " of spades ");
}
}
}