可编辑版
Word完美格式
【问题描述】 学期考试结束,统计某班每个人的平均成绩,每门课的平均成绩,并按个人平均成绩从高到低的顺序输出成绩,输出不及格人名单。输入、输出格式自定。【实现提示】考试课程有:高等数学、物理、外语、C语言4门课程。录入所有同学的成绩,对数据进行处理,输出所要求的内容,程序的功能主要包括以下几个方面: ① 输入成绩② 修改记录③ 删除记录④ 输出成绩并按平均成绩排序,并标记平均分不及格的学生。⑤ 界面提供上述功能选择。
代码#include
#include
#include
int menu=0;
typedef struct CLASS{
char name[15];
int maths;
int physics;
int english;
int c_language;
struct CLASS* next;
}linkNode;
struct AVERAGE{
char name[15];
float per_average;
struct AVERAGE* aver_next;
};
typedef struct AVERAGE* Average;
typedef linkNode* Class;
Average create_average_list(Class info_list_head);
Class add_student_info(Class head);
Class delete_student_info(Class head,char *stu_name);
void modify_student_info(Class head,char *stu_name);
void sort_average(Average);
void print_student_info(Class head);
void print_average_score(Average head);
void caculate_class_average(Class info_list_head);
void main_menu(void);
int main(void)
{
linkNode * link_list_head=NULL;
struct AVERAGE *pAver_head=NULL;
char *student_name;
while(1)
{
switch(menu){
case 0:{
main_menu();
}break;
case 1:{
link_list_head = add_student_info(link_list_head);
menu =0;
}break;
case 2:{
if(link_list_head!=NULL)
{
printf("If you want to modify student's information,please input the name: ");
scanf("%s",student_name);
}
modify_student_info(link_list_head,student_name);
menu =0;
}break;
case 3:{
if(link_list_head!=NULL)
{
printf("If you want to delete student's information,please input the name: ");
scanf("%s",student_name);
}
link_list_head=delete_student_info(link_list_head,student_name);
menu =0;