Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Console.WriteLine("Press u0022Enteru0022 to play!");
- int num = 0;
- void WaitForKey(ConsoleKey key)
- {
- while (Console.ReadKey(true).Key != key)
- {
- }
- }
- for (int i = 1; i <= 10; i++)
- {
- WaitForKey(ConsoleKey.Enter);
- Console.Write("{0}", num);
- num++;
- }
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Press u0022Enteru0022 to play!");
- int num = 0;
- for (int i = 1; i <= 10; i++)
- {
- do
- {
- ConsoleKeyInfo keypress;
- ConsoleKeyInfo oldkeypress;
- keypress = Console.ReadKey(true);
- oldkeypress = keypress;
- keypress = Console.ReadKey(true);
- if (oldkeypress != keypress)
- {
- Console.WriteLine("{0}", num);
- num++; ;
- oldkeypress = keypress;
- }
- } while (1==1);
- }
- static void Main(string[] args)
- {
- try
- {
- Console.WriteLine("Press u0022Enteru0022 to play!");
- int num = 0;
- for (int i = 1; i <= 10; i++)
- {
- WaitForKey();
- Console.Write("{0}", num);
- num++;
- }
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex);
- }
- }
- static void WaitForKey()
- {
- Console.ReadKey(true);
- while (!Console.KeyAvailable)
- Thread.Sleep(10);
- }
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- ConsoleKeyInfo keypress;
- ConsoleKeyInfo oldkeypress;
- keypress = Console.ReadKey(true);
- oldkeypress = keypress;
- do
- {
- keypress = Console.ReadKey(true); // read keystrokes
- if (oldkeypress != keypress)
- { Console.Write(keypress.KeyChar);
- oldkeypress = keypress;
- }
- } while (1==1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement