Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. Console.WriteLine("Press u0022Enteru0022 to play!");
  4. int num = 0;
  5. void WaitForKey(ConsoleKey key)
  6. {
  7. while (Console.ReadKey(true).Key != key)
  8. {
  9.  
  10. }
  11. }
  12. for (int i = 1; i <= 10; i++)
  13. {
  14. WaitForKey(ConsoleKey.Enter);
  15. Console.Write("{0}", num);
  16. num++;
  17. }
  18. }
  19.  
  20. using System;
  21. using System.Collections.Generic;
  22. using System.IO;
  23. using System.Linq;
  24. using System.Text;
  25. using System.Threading.Tasks;
  26.  
  27. namespace ConsoleApp2
  28. {
  29. class Program
  30. {
  31. static void Main(string[] args)
  32. {
  33. TextWriter OutSt = Console.Out;
  34. while (1 == 1)
  35. {
  36. Console.SetOut(TextWriter.Null);
  37. ConsoleKeyInfo KeyInfo = Console.ReadKey();
  38.  
  39. if (KeyInfo.Modifiers == ConsoleModifiers.Control & KeyInfo.Key == ConsoleKey.E) { Console.SetOut(OutSt); Console.WriteLine("Print string"); };
  40.  
  41. if (KeyInfo.Modifiers == ConsoleModifiers.Alt & KeyInfo.Key == ConsoleKey.E) { break; };
  42.  
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement