如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
平顶山学院软件学院10级软工二班学生信息管理系统VC++6.0//学生信息管理系统#include<iostream>#include<malloc.h>#include<iomanip>#defineNULL0#defineLENsizeof(structstudent)//建立动态链表.cppusingnamespacestd;structstudent{intnum;charname[20];charsex[5];floatmath;floatenglish;intorder;structstudent*next;};intn;intmale=0;intfamale=0;structstudent*creat(void){structstudent*head,*p1,*p2;n=0;p1=p2=(structstudent*)malloc(LEN);cout<<"下面开始创建链表:"<<endl;cout<<"学号"<<"姓名"<<"性别"<<"数学"<<"英语"<<endl;cin>>p1->num>>p1->name>>p1->sex>>p1->math>>p1->english;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;}p2->next=NULL;if(head==NULL){cout<<"创建失败,请重建:"<<endl;head=creat();}returnhead;}//输出链表的函数voidprint(structstudent*head){cout<<"此时链表的内容为:"<<endl;cout<<"学号"<<"姓名"<<"性别"<<"数学"<<"英语"<<"总分"<<endl;structstudent*p;p=head;if(head!=NULL)do{cout<<""<<setiosflags(ios_base::left)<<setw(3)<<p->num<<setw(6)<<p->name<<setw(5)<<p->sex<<setw(5)<<p->math<<setw(4)<<p->english<<setw(5)<<p->math+p->english<<resetiosflags(ios_base::left)<<endl;p=p->next;}while(p!=NULL);}//链表结点的删除操作structstudent*del(structstudent*head){if(n==0){cout<<"无链表可删除"<<endl;exit(0);}intnum;cout<<"请输入要删除的序号:";cin>>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){if(p1==head){if(strcmp(p1->sex,"男")==0)male--;elsefamale--;head=p1->next;}else{if(strcmp(p1->sex,"男")==0)male--;elsefamale--;p2->next=p1->next;}cout<<num<<"号已被删除"<<endl;n--;}elsecout<<"未找到此数据!"<<endl;cout<<"请输入要删除的序号";cin>>num;}if(n==0){cout<<"此时链表已为空!"<<endl;exit(0);}returnhead;}//插入结点struc