namespace ConsoleApplication2{ class Program { static void Main(string[] args) { try { Console.WriteLine("请输入会员本月的消费记录"); double[] mon = new double [5]; double sum = 0; for (int i = 0; i < mon.Length; i++) { Console.WriteLine(""); Console.WriteLine("请输入第{0}笔消费金额:", i + 1); mon[i] = Convert.ToDouble(Console.ReadLine()); } for (int i = 0; i<mon.Length;i++)
{
Console.WriteLine("序号\t\t\t金额(元)");
Console.WriteLine("{0}\t\t\t{1}",i+1,mon[i]);
sum += mon[i];
}
Console.WriteLine("总金额\t\t\t" +sum);
}
catch
{
Console.WriteLine("你输入的格式有误");
}
Console.ReadKey();
}
}
}