題目
登錄成功
代碼
int max = 99999;
int min = 1000;
Random rd = new Random();
rd.Next(min, max);
int a = 0;
int id =0;
string user = ""; string key = ""; string b = ""; Console.WriteLine("*****歡迎進(jìn)入獎(jiǎng)客富翁系統(tǒng)*****");
Console.WriteLine(" 1.注冊");
Console.WriteLine(" 2.登錄");
Console.WriteLine(" 3.抽獎(jiǎng)"); Console.WriteLine("******************************"); Console.WriteLine("請選擇菜單:");
a = Convert.ToInt32(Console.ReadLine());
switch (a)
{
case 1:
Console.WriteLine("[獎(jiǎng)客富翁系統(tǒng)>注冊]");
Console.WriteLine("請?zhí)顚懹脩糇孕畔?");
Console.WriteLine("用戶名:");
user = Console.ReadLine();
Console.WriteLine("密碼:");
key = Console.ReadLine();
Console.WriteLine("注冊成功言询,請記好你的會(huì)員卡號");
Console.WriteLine("用戶名\t\t密碼\t\t會(huì)員卡號"); Console.WriteLine("{0}\t\t{1}\t\t{2}", user, key, rd.Next(min, max)); Console.WriteLine("繼續(xù)嗎?(y/n)");
b = Console.ReadLine();
break;
case 2:
Console.WriteLine("[獎(jiǎng)客富翁系統(tǒng)>登錄]");
Console.WriteLine("請輸入用戶名:");
user = "admin";
key ="123456";
string yonghu =Console.ReadLine();
Console.WriteLine("請輸入密碼:");
string mima =Console.ReadLine();
for (int i = 0; i < 4; i++)
{
if (user == yonghu & key == mima)
{
Console.WriteLine("歡迎您:{0}", yonghu); break; }
else
{
Console.WriteLine("你還剩{0}次機(jī)會(huì)", 3 - i); continue;
}
}
break;
case 3: Console.WriteLine("[獎(jiǎng)客富翁系統(tǒng)>抽獎(jiǎng)]");
Console.WriteLine("請輸入你的卡號");
id =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("今日的幸運(yùn)數(shù)字為:");
for(int i =0;i<4;i++)
{
Console.WriteLine(rd.Next(min, max));
}
if (rd.Next(min, max) == id)
{
Console.WriteLine("恭喜乏苦!你是本日的幸運(yùn)會(huì)員!");
}
else
{
Console.WriteLine("抱歉苔咪!您不是本日的幸運(yùn)會(huì)員际乘!");
}
break;
}
Console.WriteLine("繼續(xù)嗎?(y/n)");
b = Console.ReadLine();
switch (b)
{
case "n":
Console.WriteLine("系統(tǒng)退出装黑,謝謝使用");
break;
case "y":
Console.WriteLine("");
break;
}
Console.ReadKey();