/* (Start of program header annotation)
* Copyright and version Declaration of the program
* Copyright (c) 2011, a student from the computer College of Yantai University
* All rights reserved.
* File name: Enter consecutive characters until a specific character is entered to end the program (assuming that the program ends by ESC)
* Author: Lei hengxin
* Completion date: January 1, September 4, 2012
* Version No.: V1.0
* Description of tasks and Solutions
* Input description:
* Problem description:
* Program output:
* End the comment in the program Header
*/
[Csharp]
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Namespace ConsoleApplication_ReadKey
{
Class Program
{
Static void Main (string [] args)
{
Console. Write ("press a key :");
Lelekeyinfo I = Console. ReadKey (true );
While (! I. Key. ToString (). ToLower (). Equals ("escape "))
{
Console. WriteLine (I. Key. ToString ());
Console. Write ("Please press :");
I = Console. ReadKey (true );
}
Console. ReadKey (false );
}
}
}
Running result:
Experience Accumulation:
1. I understand
[Csharp]
ConsoleKeyInfo.
2. Console. ReadKey (false); wait for the user to enter a number and display it on the Console.