资源描述:
《c语言课程设计成绩管理系统代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、C语言课程设计成绩管理系统代码#defineLsizeof(structstudent)#includestructstudent{charname[10];//姓名longnum;//学号charsex[3];//性别intgrade;//班级floatscore1,score2,score3,score4;//四门课成绩floatall;//总分floataverage;//平均分structstudentnext;//指向下一个结点的指针};structstudenthead
2、;//全局指针变量chara;voidinput(structstudentq){structstudentp;while(1){p=(structstudent)malloc(L);//开辟存储空间printf("输入姓名:");scanf("%s",p->name);printf("输入学号:");scanf("%ld",&p->num);printf("输入性别:");scanf("%s",p->sex);printf("输入班级:");scanf("%d",&p->grade);printf
3、("输入四门课成绩:");scanf("%f%f%f%f",&p->score1,&p->score2,&p->score3,&p->score4);fflush(stdin);p->all=p->score1+p->score2+p->score3+p->score4;p->average=p->all/4;p->next=q;q=p;printf("是否回主菜单(Y/N):");scanf("%c",&a);if(a=='Y'a=='y')break;}}voidadd(){structstud
4、entp1,p2;charc;p2=(structstudent)malloc(L);p1=head;while(1){while(p1->next!=0)p1=p1->next;printf("输入姓名:");scanf("%s",p2->name);printf("输入学号:");scanf("%ld",&p2->num);printf("输入性别:");scanf("%s",p2->sex);printf("输入班级:");scanf("%d",&p2->grade);printf("输入四门
5、课成绩:");scanf("%f%f%f%f",&p2->score1,&p2->score2,&p2->score3,&p2->score4);fflush(stdin);p2->all=p2->score1+p2->score2+p2->score3+p2->score4;p2->average=p2->all/4;p2->next=0;p1->next=p2;printf("是否回主菜单?(y/n):");scanf("%c",&c);fflush(stdin);if(c=='y'c=='Y'
6、)break;}}voidfind(structstudentp){longb;intflag;//判断标志while(1){printf("输入学号:");scanf("%ld",&b);flag=0;while(p!=0){if(p->num==b){printf("姓名t学号t性别t班级t语文t数学t外语t综合t总分t平均分");printf("%st%ldt%st%dt%.2ft%.2ft%.2ft%.2ft%.2ft%.2f",p->name,p
7、->num,p->sex,p->grade,p->score1,p->score2,p->score3,p->score4,p->all,p->average);flag=1;break;}//如果结点的学号和要查找的学号相等,输出结点信息,同时标志变为1elsep=p->next;//p指向下一结点}if(flag==0)//判断标志是0或1,确定循环结束的形式printf("无查询结果!");//若标志为0,提示无查找结果printf("是否回主菜单(Y/N):");fflush(stdin
8、);scanf("%c",&a);if(a=='Y'a=='y')break;}}voiddel(){structstudentp1,p2,p;chart;longb;intflag=0;while(1){printf("请输入学号:");scanf("%ld",&b);if(head->num==b){p=head;printf("姓名t学号t性别t班级t语文t数学t外语t综合t总分t平均分");printf("%st%ldt%st%d