要求: 輸入對應個數的手機號碼或者數字, 完成隨機抽獎;
隨機抽獎這一段沒有實作按鍵暫停顯示結果,console端可以實作嗎; <代碼參考了網路版本>
Console.Write("please input cellphone numbers:");
int a = int.Parse(Console.ReadLine());
string[] sj = new string[a];
for (int i = 0; i < a; i++)
{
Console.Write("please input the" + " " + (i + 1) + " " + "cellphone number:");
sj[i] = Console.ReadLine();
}
foreach(string aaa in sj)
{
Console.WriteLine(aaa);
}
Console.WriteLine("The Above are the stored" + " " + a + " " + "cellphone numbers");
//Console.WriteLine("{0} + {1} + {2}", sj[0],sj[1],sj[2]);
Console.WriteLine("input finish,press enter to start lucky draw!Press Enter again to stop");
Console.ReadLine();
Random ran = new Random();
int r = 0;
for (; ; )
{
int aa = ran.Next(a);
Console.Clear();
Console.WriteLine(sj[aa]);
System.Threading.Thread.Sleep(50);
if (r == 59)
{
//Console.Clear();//作弊代碼
//Console.WriteLine("110");
break;
}
r++;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/224126.html
標籤:其他
上一篇:解決Mac bigsur 中 Can‘t use Subversion command line client:svn
下一篇:(五)Redis的sacn
