成绩的编程:如何用C语言编程这个题目:有5个学生,每个学社有四门课程,将有不及格课程的学生成绩输出

这个问题是我们刚学数组的题目

建立一个两维数组,学生为第一个下标,课程为第二个下标,成绩做数组项的值,然后遍历数组,如果小于60就输出成绩就可以了

或者建立五个一维数组,课程做下标,成绩做值,然后遍历输出就可以了
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-05-10
这个可以用结构体实现:

typedef struct
{
float score1;
float score2;
float score3;
float score4;
}student;

int CheckScore(student *student)
{
if(student->score1<60||student->score2<60||student->score3<60||student->score4<60)
return 1;
else
return 0;
}

main()
{
student student[5];
int i;
for(i=0;i<5;i++)
if(CheckScore(&student[i]))
printf("%f,%f,%f,%f\n",student[i].score1,student[i].score2,student[i].score3,student[i].score4);
}本回答被提问者采纳
相似回答