From 6b0470dabf57b4481d519c3492d0644aca2d1f5c Mon Sep 17 00:00:00 2001 From: Cx330 <2011690092@qq.com> Date: Fri, 14 Apr 2023 23:32:55 +0800 Subject: [PATCH] Cx330_1 --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 93f4c5b..41ab212 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,40 @@ #define STU_NUM 30 //最多的考试人数 #define COURSE_NUM 6 //最多的考试科目 ``` + +#### 结构体的定义 + +``` +typedef struct student{ + long num; //每个学生的学号 + char name[MAX_LEN]; //每个学生的姓名 + float score[COURSE_NUM]; //每个学生COURSE_NUM门功课的成绩 + float sum; //每个学生的总成绩 + float aver; //每个学生的平均成绩 +}STU; +``` + +#### 函数声明 + +``` +int Menu(void); +void ReadScore(STU stu[],int n,int m); +void AverSumofEveryStudent(STU stu[],int n,int m); +void AverSumofEveryCourse(STU stu[],int n,int m); +void SortbyScore(STU stu[],int n,int m,int (*compare)(float a,float b)); +int Ascending(float a,float b); +int Descending(float a,float b); +void SwapFloat(float *x,float *y); +void SwapLong(long *x,long *y); +void SwapChar(char x[],char y[]); +void AsSortbyNum(STU stu[],int n,int m); +void SortbyName(STU stu[],int n,int m); +void SearchbyNum(STU stu[],int n,int m); +void SearchbyName(STU stu[],int n,int m); +void StatisticAnalysis(STU stu[],int n,int m); +void WritetoFile(STU record[],int n,int m); +void ReadfromFile(STU record[],int *n,int *m); +``` ### 成绩录入 设计思想:成绩录入是对结构体中班级、姓名、学号和五门成绩的录入,同时加上对五门成绩平均成绩的计算。按照基本的录入,只需要scanf函数对数据输入,用printf函数进行汉字的打印即可。然后进行文件保存该组数据,最后判断是否继续录入。