欢迎来到天天文库
浏览记录
ID:33103789
大小:50.00 KB
页数:11页
时间:2019-02-20
《学生信息管理完整(c实训源文件)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、个人收集整理勿做商业用途封面作者:ZHANGJIAN仅供个人学习,勿做商业用途11/11个人收集整理勿做商业用途//学生信息管理系统#include#include#include#defineNULL0#defineLENsizeof(structstudent)//建立动态链表.cppusingnamespacestd;structstudent{intnum;charname[20];charsex[5];floatmath;floatenglish;in
2、torder;structstudent*next;};intn;intmale=0;intfamale=0;structstudent*creat(void){structstudent*head,*p1,*p2;n=0;p1=p2=(structstudent*)malloc(LEN);cout<<"下面开始创建链表:"<>p1->num>>p1->name>>p1->sex>>p1->math>>p1->engl
3、ish;文档来源网络及个人整理,勿用作商业用途head=NULL;while(p1->num!=0){if(strcmp(p1->sex,"男")==0)male++;elsefamale++;n++;if(n==1)head=p1;elsep2->next=p1;p2=p1;p1=(structstudent*)malloc(LEN);cin>>p1->num>>p1->name>>p1->sex>>p1->math>>p1->english;文档来源网络及个人整理,勿用作商业用途}11/11个人收集整理勿做商业用途
4、p2->next=NULL;if(head==NULL){cout<<"创建失败,请重建:"<5、osflags(ios_base::left)<num<name<sex<math<english<math+p->english<next;}while(p!=NULL);}//链表结点的删除操作structstudent*del(struct6、student*head){if(n==0){cout<<"无链表可删除"<>num;while(num!=0){structstudent*p1,*p2;p1=head;while(num!=p1->num&&p1->next!=NULL){p2=p1;p1=p1->next;}if(num==p1->num)11/11个人收集整理勿做商业用途{if(p1==head){if(strcmp(p1->sex,"男")==0)mal7、e--;elsefamale--;head=p1->next;}else{if(strcmp(p1->sex,"男")==0)male--;elsefamale--;p2->next=p1->next;}cout<>num;}if(n==0){cout<<"此时链表已为空!"<8、ert(structstudent*head){structstudent*stu;stu=(structstudent*)malloc(LEN);cout<<"学号"<<"姓名"<<"性别"<<"数学"<<"英语"<>stu->num>>stu->name>>stu->sex>>stu->math>>stu-
5、osflags(ios_base::left)<num<name<sex<math<english<math+p->english<next;}while(p!=NULL);}//链表结点的删除操作structstudent*del(struct
6、student*head){if(n==0){cout<<"无链表可删除"<>num;while(num!=0){structstudent*p1,*p2;p1=head;while(num!=p1->num&&p1->next!=NULL){p2=p1;p1=p1->next;}if(num==p1->num)11/11个人收集整理勿做商业用途{if(p1==head){if(strcmp(p1->sex,"男")==0)mal
7、e--;elsefamale--;head=p1->next;}else{if(strcmp(p1->sex,"男")==0)male--;elsefamale--;p2->next=p1->next;}cout<>num;}if(n==0){cout<<"此时链表已为空!"<8、ert(structstudent*head){structstudent*stu;stu=(structstudent*)malloc(LEN);cout<<"学号"<<"姓名"<<"性别"<<"数学"<<"英语"<>stu->num>>stu->name>>stu->sex>>stu->math>>stu-
8、ert(structstudent*head){structstudent*stu;stu=(structstudent*)malloc(LEN);cout<<"学号"<<"姓名"<<"性别"<<"数学"<<"英语"<>stu->num>>stu->name>>stu->sex>>stu->math>>stu-
此文档下载收益归作者所有