美文网首页
2018-12-26银行取钱

2018-12-26银行取钱

作者: 大长腿快快跑 | 来源:发表于2018-12-26 12:50 被阅读0次

    Console.WriteLine("请输入你的密码:");
    string mima = "111111";
    int amount = 0;
    int count = 0;
    for (count = 0; count < 3; count++)
    {
    string shuru = Console.ReadLine();
    if (shuru != mima)
    {
    Console.WriteLine("你输入的密码有误,重新输入。");
    continue;
    }
    else
    {
    Console.WriteLine("请输入金额");
    amount = Convert.ToInt32(Console.ReadLine());
    break;
    }
    }

            for (int i = 0; i < 3; i++)
            {
                if (amount < 0 | amount > 1000 | amount %100 != 0 )
                {
                    Console.WriteLine("你输入的不合法,请重新输入");
                    amount = Convert.ToInt32(Console.ReadLine());
                    continue;
                }
                else
                {
                    Console.WriteLine("您取了{0}块钱", amount);
                    Console.WriteLine("\n" + "交易完成");
                    break;
                }
                
            }
            Console.ReadKey();

    相关文章

      网友评论

          本文标题:2018-12-26银行取钱

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