第十二节课的第一个作业
2018-12-06 本文已影响0人
zjh666
#编码
try{Console.WriteLine("请输入要四家店的价格");
int[] money=new int[4];
//输入四家店的价格
for (int i = 0; i < money.Length; i++)
{ Console.WriteLine("第{0}店的价格:",i+1);
money[i] = Convert.ToInt32(Console.ReadLine());
}
//排序
Array.Sort(money); //排列升序
//显示最小值
Console.Write("最低价格是:{0}",money[0]);
}
catch { Console.WriteLine("输入格式有误"); }
Console.ReadKey();
#效果
![](https://img.haomeiwen.com/i14494392/d34fd67ecc3fcac4.png)