習題9 6 按等級統計學生成績 (20 分)

2021-09-09 06:28:00 字數 839 閱讀 6224

本題要求實現乙個根據學生成績設定其等級,並統計不及格人數的簡單函式。

函式介面定義:

int set_grade( struct student *p, int n );

其中p是指向學生資訊的結構體陣列的指標,該結構體的定義為:

struct student;

n是陣列元素個數。學號num、姓名name和成績score均是已經儲存好的。set_grade函式需要根據學生的成績score設定其等級grade。等級設定:85-100為a,70-84為b,60-69為c,0-59為d。同時,set_grade還需要返回不及格的人數。

裁判測試程式樣例:

#include #define maxn 10

struct student;

int set_grade( struct student *p, int n );

int main()

count = set_grade(ptr, n);

printf("the count for failed (<60): %d\n", count);

printf("the grades:\n");

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

printf("%d %s %c\n", stu[i].num, stu[i].name, stu[i].grade);

return 0;

}

int

set_grade

(struct student *p,

int n )

}return other;

}

習題9 6 按等級統計學生成績

習題9 6 按等級統計學生成績 20分 本題要求實現乙個根據學生成績設定其等級,並統計不及格人數的簡單函式。int set grade struct student p,int n 其中p是指向學生資訊的結構體陣列的指標,該結構體的定義為 struct student n是陣列元素個數。學號num ...

習題9 6 按等級統計學生成績

本題要求實現乙個根據學生成績設定其等級,並統計不及格人數的簡單函式。int set grade struct student p,int n 其中p是指向學生資訊的結構體陣列的指標,該結構體的定義為 struct student n是陣列元素個數。學號num 姓名name和成績score均是已經儲存...

習題9 6 按等級統計學生成績 20分

進博主技術群,與大佬交流,領取乾貨學習資料 快速找到所需題目 浙大版c語言程式設計第三版題目集一覽表 本題要求實現乙個根據學生成績設定其等級,並統計不及格人數的簡單函式。函式介面定義 int set grade struct student p,int n 其中 p 是指向學生資訊的結構體陣列的指標...