Skip to content

Instantly share code, notes, and snippets.

@nikolaiweselinow
Created June 26, 2015 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikolaiweselinow/3df02389d79eefee6e42 to your computer and use it in GitHub Desktop.
Save nikolaiweselinow/3df02389d79eefee6e42 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class PrintADeckOf52Cards
{
static void Main()
{
Console.Title = "Problem 4. Print a Deck of 52 Cards";
Console.ForegroundColor = ConsoleColor.White;
for (int i = 2; i < 15; i++)
{
for (int j = 1; j <= 4; j++)
{
switch (i)
{
case 11:
Console.Write("J");
break;
case 12:
Console.Write("Q");
break;
case 13:
Console.Write("K");
break;
case 14:
Console.Write("A");
break;
default:
Console.Write("{0}", i);
break;
}
switch (j)
{
case 1:
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.Write("♣ ");
Console.ForegroundColor = ConsoleColor.White;
break;
case 2:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("♦ ");
Console.ForegroundColor = ConsoleColor.White;
break;
case 3:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("♥ ");
Console.ForegroundColor = ConsoleColor.White;
break;
case 4:
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.Write("♠ ");
Console.ForegroundColor = ConsoleColor.White;
break;
default:
break;
}
}
Console.WriteLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment