欢迎来到天天文库
浏览记录
ID:9311258
大小:88.50 KB
页数:15页
时间:2018-04-27
《学生管理系统java代码》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、#include#include#includetypedefstructStudent{longnumber;//学号charname[20];//姓名charClass[20];//班级charprofessional[20];//专业floatChinese;//语文floatEnglish;//英语floatMath;//数学floatChemical;//化学floatPhysical;//物理structStudent*next
2、;}student;//初始化student*Initstudent(student*head);//加入学生student*addstudent(student*head);//保存信息在外部文件voidsave(student*head);//打印所有成员voidprintfstudent(student*head);//查找学生voidFindstudent(student*head);//以名字查找student*name(student*head);//以学号查找student*num
3、ber(student*head);//删除学生信息0Structstudent*del(structstudent*head);//修改学生信息correct(structstudent*head);//添加学生信息structstudent*insert(structstudent*head);//打印单个学生voidprint(student*head);//排序voidsort(student*head);//以名字排序student*Namesort(student*head);//以
4、学号排序student*Numbersort(student*head);//以班级排序student*Classsort(student*head);//以专业排序student*Professionsort(student*head);//以语文成绩排序成绩是从高到低排序student*Chinesesort(student*head);//以英语成绩排序student*Englishsort(student*head);//以数学成绩排序student*Mathsort(student*h
5、ead);//以物理成绩排序student*physicalsort(student*head);//以化学成绩排序student*Chemicalsort(student*head);#endifVoidmain(){charchoice;student*head=NULL,*q;q=Initstudent(head);do{printf("A--添加P--输出B--保存C--删除D--修改E—插入F--查找S--排序Q--退出");scanf("%c",&choice);choice=t
6、oupper(choice);switch(choice){case'A':q=addstudent(q);/*if())printf("添加成功!");elseprintf("添加失败!");*/break;case'P':printfstudent(q);break;case’B’:save(q);break;case’C’:del(q);break;case’D’:correct(q);break;case’E’:insert(q);break;case'F':Findstuden
7、t(q);break;case'S':sort(q);break;case'Q':printf("再见!");break;default:printf("选择错误!a");}}while(choice='Q');}structAchievement{intChinese;intEnglish;intMath;intChemical;intPhysical;}student*Initstudent(student*head){student;head=(student*)malloc(s
8、izeof(student));if(head==NULL){printf("预约空间失败");exit(1);}head->next=NULL;head->length=0;returnhead;}student*addstudent(student*head){student*s,*p;intA,B,C,D,E;s=(student*)malloc(sizeof(student));//s->S=(Achievement*)malloc(sizeof(Achievement));二级指针
此文档下载收益归作者所有