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