测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A36991. 函数fun()的功能是:在有n个元素的结构体数组std中,查找有不及格科目的学生,找到后输出学生的学号;函数的返回值是有不及格科目的学生人数。例如,主函数中给出了4名学生的数据,则程序运行的结果为:学号:N1002 学号:N1006共有2位学生有不及格科目#include <stdio.h>#include <stdlib.h>typedef struct{ char num[8]; doubl…

填空题 困难

题目描述

函数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");

}

参考答案

<p>1. 正确答案: STU</p><p>2. 正确答案: ||</p><p>3. 正确答案: k</p>
上一题 下一题