Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace Kirill_Lox
  5. {
  6. class Program
  7. {
  8. public static string[] Try = new string[] { "gelbyukjh", "ljkjqg ghtplbtynf", "lfblbnsyfeq" };
  9. public static bool flag = true;
  10. static void Main(string[] args)
  11. {
  12. var periodicity = new TimeSpan(0, 0, 1);
  13. Thread th = new Thread(Timer);
  14. th.Start(periodicity);
  15. Chek();
  16. Console.ReadKey();
  17. }
  18.  
  19. public static void Timer(object periodicity)
  20. {
  21. var time = default(TimeSpan);
  22. var thePeriodicity = (TimeSpan)periodicity;
  23. while (flag != false)
  24. {
  25. Thread.Sleep(thePeriodicity);
  26. time = time.Add(thePeriodicity);
  27. }
  28. Console.WriteLine(time);
  29. Console.ReadKey();
  30. }
  31.  
  32. public static void Chek()
  33. {
  34. int miss = 0;
  35. for (int i = 0; i < Try.Length; i++)
  36. {
  37. Console.WriteLine(Try[i]);
  38. string key = Console.ReadLine();
  39. if (Try[i].ToLowerInvariant().Contains(key))
  40. {
  41. Try[i].Replace(key, " ");
  42. miss = Try[i].Length;
  43. }
  44. if (miss > 0)
  45. {
  46. Console.WriteLine("Try again");
  47. i -= 1;
  48. }
  49. }
  50. flag = false;
  51. Console.WriteLine($"Количество ошибок - {miss}");
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement