代码图
.效果图
.代码
try
{
double sum = 0;
Console.WriteLine("请输入本月会员消费金额");
Double[] money = new Double[5];
for (int i = 0; i < money.Length; i++)
{
Console.Write("请输入第{0}款金额:",i+1);
money[i] = Convert.ToDouble(Console.ReadLine());
sum = money[i] + sum;
}
Console.WriteLine("序号\t金额(元)");
for (int i = 0; i < money.Length; i++)
{
Console.WriteLine("{0}\t{1}",i+1,money[i]);
if (i == money.Length-1)
{
Console.WriteLine("总金额\t{0}",sum);
}
}
}
catch
{
Console.WriteLine("输入有错啊啊啊!!");
}
Console.ReadKey();
网友评论