代码
namespace 训练三
{
class Program
{
static void Main(string[] args)
{
try
{
string num;
do
{
Console.WriteLine("******欢迎进入奖客富翁系统********");
Console.WriteLine("\t 1.注册");
Console.WriteLine("\t 2.登入");
Console.WriteLine("\t 3.抽奖");
Console.WriteLine("******************************");
Console.Write("请选择菜单:");
int sum = Convert.ToInt32(Console.ReadLine());
if (sum == 1)
{
Console.WriteLine("奖客富翁系统----注册");
Console.WriteLine("请填入你的个人注册信息");
Console.Write("用户名:");
string name = Console.ReadLine();
Console.Write("密码:");
string mima = Console.ReadLine();
Console.WriteLine("注册成功,请记好您的会员卡号");
int max = 99999999;
int min = 10000000;
Random rd = new Random();
int shu=rd.Next(min, max);
Console.WriteLine("用户名\t密码\t会员卡号");
Console.WriteLine("{0}\t{1}\t{2}",name,mima,shu);
}
else if (sum == 2)
{
Console.WriteLine("奖客富翁系统----登入");
Console.Write("请输入用户名:");
string Name = Console.ReadLine();
Console.Write("请输入密码:");
string Mima = Console.ReadLine();
Console.WriteLine();
Console.WriteLine("欢迎你{0}",Name);
}
else if (sum == 3)
{
Console.WriteLine("奖客富翁系统----抽奖");
Console.Write("请输入你的会员卡号:");
int shu = Convert.ToInt32(Console.ReadLine());
int max = 99999999;
int min = 10000000;
Random rd = new Random();
int yi = rd.Next(min, max);
int er = rd.Next(min, max);
int san = rd.Next(min, max);
int si = rd.Next(min, max);
int wu = rd.Next(min, max);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", yi, er, san, si, wu);
if (shu == yi)
{
Console.Write("您是本次的幸运会员");
}
else if (shu == er)
{
Console.Write("您是本次的幸运会员");
}
else if (shu == san)
{
Console.Write("您是本次的幸运会员");
}
else if (shu == si)
{
Console.Write("您是本次的幸运会员");
}
else if (shu == wu)
{
Console.Write("您是本次的幸运会员");
}
else
{
Console.Write("抱歉,您不是本次的幸运会员");
}
}
else
{
Console.Write("你的输入有误");
}
Console.Write("是否继续(y/n):");
num = Console.ReadLine();
if (num == "n")
{
Console.Write("程序退出,谢谢使用");
}
}
while (num == "y");
}
catch
{
Console.Write("您的输入有误");
}
}
}
}