美文网首页
2018-12-26练习二

2018-12-26练习二

作者: 吾_5c00 | 来源:发表于2018-12-26 12:24 被阅读0次

    try
    {
    string pass;
    int count = 1;
    int amount = 0;
    string password = "111111";
    bool ispass = false;

                Console.WriteLine("请输入密码:");
                pass = Console.ReadLine();
    
                while (count < 3 && !ispass)
                {
                    if (pass != password)
                    {
                        count++;
                        Console.WriteLine("请输入密码");
                        pass = Console.ReadLine();
                        continue;
                    }
                    Console.WriteLine("请输入金额");
                    amount =Convert .ToInt32(Console .ReadLine ());
                    while (amount > 1000 || amount % 100 != 0)
                    {
                        Console.WriteLine("请输入金额");
                        amount = Convert.ToInt32(Console .ReadLine());
                    }
                    ispass = true;
                    break;
    
                }
                if (count >= 3)
                {
                    Console.WriteLine("你三次密码输入错误,卡被冻结");
                }
                if (ispass)
                {
                    Console.WriteLine("你取出了{0}元",amount );
                    Console.WriteLine("交易成功");
                }
    
            }
            catch
            {
                Console.WriteLine("程序错误!!");
            }
            Console.ReadKey();

    相关文章

      网友评论

          本文标题:2018-12-26练习二

          本文链接:https://www.haomeiwen.com/subject/cyhhlqtx.html