作者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