编一个程序,要求利用循环语句从键盘输入5个学生成绩,统计并输出这5个成绩的及格人数、最高分,平均分

急用啊
VFP的

第1个回答  2011-11-02
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#的 这个知道乱推荐啊!!!