Advertisement
ScreeM

3.CheckForPlayCard

Apr 7th, 2014
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using System;
  2. class CheckPlayCard
  3. {
  4. static void Main(string[] args)
  5. {
  6.  
  7. string[] playCards = new string[] { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A" };
  8. while (true)
  9. {
  10. Console.ForegroundColor = ConsoleColor.White;
  11. Console.Write("Enter your symbol:\t");
  12. string enteredSymbol = Console.ReadLine();
  13. int pos = Array.IndexOf(playCards, enteredSymbol);
  14. if (pos != -1)
  15. {
  16. Console.ForegroundColor = ConsoleColor.DarkGreen;
  17. Console.WriteLine("\n{0} is a playing card symbol.\n", enteredSymbol);
  18. }
  19. else
  20. {
  21. Console.ForegroundColor = ConsoleColor.DarkRed;
  22. Console.WriteLine("\n{0} is NOT correct.\n", enteredSymbol);
  23. }
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement