#作业目标:
##编码:
try
{
Console.WriteLine("请输入会员本月的消费记录");
double[] money = new double[5];
double sum = 0;
for (int i = 0; i < money.Length; i++)
{
Console.WriteLine("请输入第{0}笔购物金额:", i + 1);
money[i] = Convert.ToInt32(Console.ReadLine());
sum += money[i];
}
Console.WriteLine("序号\t金额");
for (int i = 0; i < money.Length; i++)
{
Console.WriteLine("{0}\t{1}",i+1m,money[i]);
}
Console.WriteLine("总金额\t{0}", sum);
}
catch { Console.WriteLine("你输入格式有误"); }
Console.ReadKey();
网友评论