C# Keyboard Input (Beginner Help)
Posted
by ThickBook
on Stack Overflow
See other posts from Stack Overflow
or by ThickBook
Published on 2010-06-18T08:34:36Z
Indexed on
2010/06/18
8:43 UTC
Read the original article
Hit count: 223
I am trying to ask user "enter any key and when that key is pressed it shows that "You Pressed "Key". Can you help what's wrong in this code?
This is what I have written
using System;
class Program
{
public static void Main(string[] args)
{
Console.Write("Enter any Key: ");
char name = Console.Read();
Console.WriteLine("You pressed {0}", name);
}
}
© Stack Overflow or respective owner