效果

代码
string cd = "";
string sf = "y";
string yhm = "";
string mm = "";
string yhm1 = "";
string mm1 = "";
int max = 99999;
int min = 1000;
Random rd = new Random();
int rdnum =0;
bool zc = false;
bool dlcg = false;
bool xysz = false;
do
{
Console.WriteLine(@"*****欢迎进入奖客富翁系统*****
1.注册
2.登录
3.抽奖
******************************");
Console.Write("请选择菜单:");
cd = Console.ReadLine();
switch (cd)
{
case "1":
Console.WriteLine("奖客富翁系统>注册");
Console.WriteLine("请填写个人注册信息");
Console.Write("用户名:");
yhm = Console.ReadLine();
Console.Write("密码:");
mm = Console.ReadLine();
Console.WriteLine("注册成功,记好你的会员卡号");
Console.WriteLine("用户名 密码 会员卡号");
rdnum = rd.Next(min, max);
Console.WriteLine("{0} {1} {2}",yhm,mm,rdnum);
zc = true;
break;
case "2":
if (zc == true)
{
Console.WriteLine("奖客富翁系统>登录");
Console.Write("用户名:");
yhm1 = Console.ReadLine();
Console.Write("密码:");
mm1 = Console.ReadLine();
if (yhm1 == yhm || mm1 == mm)
{
Console.WriteLine("欢迎你{0}", yhm);
dlcg = true;
}
else
{
Console.WriteLine("用户名密码错误");
dlcg = false;
}
}
else
{
Console.WriteLine("先注册");
}
break;
case "3":
if (dlcg == true)
{
Console.WriteLine("奖客富翁系统>抽奖");
Console.WriteLine("你的会员卡号是{0}", rdnum);
Console.WriteLine("今天的幸运数字是");
for (int i = 0; i < 5; i++)
{
int[] df = new int[5];
df[i] = rd.Next(min, max);
Console.Write(df[i]+" ");
if (rdnum == df[i])
{
xysz = true;
}
}
if (xysz == true)
{
Console.WriteLine("是幸运数字");
}
else
{
Console.WriteLine("不是幸运数字");
}
xysz = false;
}
else
{
Console.WriteLine("先登录");
}
break;
default:
Console.WriteLine("您的输入有误!");
break;
}
Console.Write("继续吗?(y/n):");
sf = Console.ReadLine();
if (sf=="y")
{
}
else if (sf == "n")
{
Console.WriteLine("退出系统谢谢使用");
}
else
{
Console.WriteLine("输入错误等于退出");
Console.WriteLine("退出系统谢谢使用");
sf = "n";
}
} while (sf=="y");
Console.ReadKey();
网友评论