##
try
{
Console.WriteLine("请输入4家店的价格");
int []money = new int [4];
int min = 0;//储存最低的价格
for (int i = 0; i < money.Length; i++)
{
Console.Write("第{0}家店的价格:",i+1);
money[i] = Convert.ToInt32(Console.ReadLine());
if (i==0)
{
min = money[i];
}
if (money[i]<min)
{
min = money[i];
}
}
Console.WriteLine("最低价格为:{0}",min);
}
catch
{
Console.WriteLine("输入有误,程序结束");
}
Console.ReadKey();
网友评论