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

2021-09-18 07:52:48 字數 1126 閱讀 9305

】進博主技術群,與大佬交流,領取乾貨學習資料

快速找到所需題目:浙大版c語言程式設計第三版題目集一覽表

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

函式介面定義:

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 temp;

}

習題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 分)

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