int pass = 0;
int max = 0;
int avg = 0;
for (int i = 1; i < 6; )
{
int current;
Console.WriteLine("请输入第{0}个学生的成绩",i);
if (int.TryParse(Console.ReadLine(), out current) == false ||
current < 0 || current > 100)
{
Console.WriteLine("输入有误,请重试");
continue;
}
if (current >= 60)
{
pass++;
}
if (current > max)
{
max = current;
}
avg += current;
i++;
}
avg = avg / 5;
Console.WriteLine("及格人数 " + pass);
Console.WriteLine("最高分 " + max);
Console.WriteLine("平均分 " + avg);
Console.Read();
追问int pass= 0; 不能识别的命令谓词 怎么能 一点也不会?
追答算了 我以为是C#的 这个知道乱推荐啊!!!