Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Opgave_4_5
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int count = 0;
  15.  
  16. while(true)
  17. {
  18. Console.Clear();
  19. Console.Write("Gæt et ord: ");
  20. string ord = Console.ReadLine();
  21. Console.Clear();
  22.  
  23. if (ord == "slut")
  24. {
  25. Console.ForegroundColor = ConsoleColor.Green;
  26. Console.WriteLine("Du gættet rigtigt!");
  27. Console.ForegroundColor = ConsoleColor.Gray;
  28. ++count;
  29. Console.Write("Du brugte {0} forsøg", count);
  30. Thread.Sleep(5000);
  31. count = 0;
  32. }
  33. else
  34. {
  35. Console.ForegroundColor = ConsoleColor.Red;
  36. Console.Write("Du gættet ikke rigtigt");
  37. Console.ForegroundColor = ConsoleColor.Gray;
  38. Console.Write(":(");
  39. Thread.Sleep(2000);
  40. count++;
  41. }
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement