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();
网友评论