日期:2014-05-18  浏览次数:20725 次

c#求高手给小弟看看那里出错了怎么改
int sum = 0;
  int hignrun = 0;
  //int people;
  Console.WriteLine("请输入班级总人数");
  int people = Convert.ToInt32(Console.ReadLine());
  int[]score=new int[people];
  for (int i = 0; i < score.Length; i++)
  {
  Console.WriteLine("请输入学号为{0}的成绩", i++);
  score[i] = Convert.ToInt32(Console.ReadLine());
  sum = sum + score[i];

  }

  for (int i = 0; i < score.Length; i++)
  {
  hignrun = score[0];
  if (score[i] > hignrun)
  { hignrun = score[i]; }


  }
  for (int i = 0; i < score.Length; i++)
  {
  Console.WriteLine("学号为{0}的学生成绩为{1}",i++,score[i]);

  }
  Console.WriteLine("班级总人数为{0},总分为{1},平均分为{2},最高分为{3}",people,sum,sum/people,hignrun);
  Console.ReadLine();

------解决方案--------------------
Console.WriteLine("请输入学号为{0}的成绩", i++);---》 Console.WriteLine("请输入学号为{0}的成绩",i.ToString());
Console.WriteLine("学号为{0}的学生成绩为{1}",i++,score[i]);--》 Console.WriteLine("学号为{0}的学生成绩为{1}", i.ToString(), score[i]);