12.27小游戏

string user; string newuser; string password;

string newpassword; int card;

int min = 1000; int max = 9999;

Random rd = new Random();

rd.Next(min, max);

try

{

Console.WriteLine("******欢迎进入奖客富翁系统******");

Console.WriteLine("\t\t1.注册");

Console.WriteLine("\t\t2.登录");

Console.WriteLine("\t\t3.抽奖");

Console.WriteLine("********************************");

Console.Write("请选择菜单:");

string a = Console.ReadLine();

switch (a)

{

case "1":

Console.WriteLine("奖客富翁系统>注册");

Console.Write("继续吗?(y/n):");

string b = Console.ReadLine();

if (b == "y")

{

Console.WriteLine("请填写个人注册信息:");

Console.Write("用户名:");

user = Console.ReadLine();

Console.Write("密码:");

password = Console.ReadLine();

Console.WriteLine("注册成功,请记好您的会员卡号");

Console.WriteLine("用户名\t\t\t密码\t\t\t会员卡号");

Console.WriteLine("{0}\t\t\t{1}\t\t\t{2}",user,password,rd.Next(min, max));

}

else if (b == "n")

{

Console.WriteLine("程序退出,谢谢使用!");

}

else

{

Console.WriteLine("您的输入有误");

}

break;

case "2":

Console.WriteLine("奖客富翁系统>登录");

int i = 3;

while (i>0)

{

Console.Write("请输入用户名:");

user = "admin";

newuser = Console.ReadLine();

Console.Write("请输入用户密码:");

password = "123456";

newpassword =Console.ReadLine();

if (newuser=="admin" && newpassword=="123456")

{

Console.WriteLine("{0},欢迎您的登录!",user);

break;

}

else

{

if (i>0)

{

Console.WriteLine("你还有{0}次机会",i-1);

i--;

continue;

}

else

{

Console.WriteLine("你没有机会了,退出程序!");

break;

}

}

}

break;

case "3":

Console.WriteLine("奖客富翁系统>抽奖");

Console.Write("请输入您的卡号:");

card = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("本日的随机数是:");

for (int d = 0; d < 5; d++)

{

Console.WriteLine("{0}", rd.Next(min, max));

}

if (card== rd.Next(min, max))

{

Console.WriteLine("");

}

else

{

Console.WriteLine("很抱歉,您不是本日会员!");

}

break;

default:

Console.WriteLine("您的输入有误!");

break;

}

}

catch

{

Console.WriteLine("您输入的格式有误,请重新输入!");

}

Console.ReadKey();

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • string user; string newuser; string password; string newp...
    beloved0114阅读 2,286评论 0 0
  • 代码: namespace ConsoleApplication1 { class Program { ...
    你不要难过阅读 3,207评论 0 0
  • bool b = true; while (b) { Console.WriteLine("*****欢迎进入奖客...
    zjh666阅读 1,589评论 0 0
  • 知识点: 注:int类型默认32位有大小范围 且第一位为符号位 0 为正 1 为负 8.4作业 A:1、风力预警系...
    cGunsNRoses阅读 4,760评论 0 0
  • 梦回都城南庄 是夜,月色如水,夜晚的长安城灯火通明。时值初春,乍暖还寒,街道两旁的柳絮纷纷,落在了小贩的肩上,他顺...
    桑桑Sandra阅读 3,089评论 0 6

友情链接更多精彩内容