作者theAvatar (I'm)
看板C_Sharp
标题Re: [问题] 谁能挑战这程式?
时间Fri Jan 9 23:44:18 2004
※ 引述《multidecoy (站起来!激钢人!!)》之铭言:
: 虽然我是学JAVA的,不过我也想知道...
用 Java(TM) 的恐怕就只能说抱歉了...
http://longhorn.msdn.microsoft.com
/lhsdk/ref/ns/system/c/console/m/readkey1.aspx
--
using System;
using System.Text;
class a
{
static void Main()
{
Console.Write("Input a password: ");
StringBuilder sb = new StringBuilder();
while (true)
{
ConsoleKeyInfo cki = Console.ReadKey(true);
if (cki.Key == ConsoleKey.Enter)
{
Console.WriteLine();
break;
}
if (cki.Key == ConsoleKey.BackSpace)
{
if (sb.Length > 0)
{
Console.Write("\b\0\b");
sb.Length--;
}
continue;
}
Console.Write('*');
sb.Append(cki.KeyChar);
}
Console.WriteLine("Your password is: {0}", sb.ToString());
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.94.64
1F:→ Hugh:这意思是要我们等到longhorn上市? 2006? 推 210.85.196.13 01/10