填空题

函数fun()的功能是:在有n个元素的结构体数组std中,查找有不及格科目的学生,找到后输出学生的学号;函数的返回值是有不及格科目的学生人数。例如,主函数中给出了4名学生的数据,则程序运行的结果为:


学号:N1002    学号:N1006

共有2位学生有不及格科目

#include <stdio.h>

#include <stdlib.h>

typedef struct

{

    char num[8];

    double score[2];

/**********found**********/

} __(1)__;

int fun(STU std[ ], int n)

    int i,k=0;

    for(i=0; i<n;i++)

    {

        /**********found**********/

        if(std[i].score[0]<60 __(2)__ std[i].score[1]<60)

        {

            k++;

            printf("学号:%s ",std[i].num);

        }

    }      

    /**********found**********/

    return __(3)__;

}

main()

{

    STU std[4]={"N1001",76.5,82.0,"N1002",53.5,73.0, 

                        "N1005",80.5,66.0,"N1006",81.0,56.0};

    printf("\n共有%d位学生有不及格科目\n", fun(std,4));

    system("pause");

}

赣ICP备20007335号-2