大学C++课程设计报告--学生成绩管理系统(附源代码) 下载本文

//定义i=1,当找到数据时把i置为0.用于输出没有找到数据 int i=1;

if(!(curnode=head->next)) { cout<<\┏━━━━━━━┓\ cout<<\┃!这是一个空表!┃\ cout<<\┗━━━━━━━┛\ curnode=p; cout<<\ return; }

while(curnode!=NULL) { switch(n) { case 1: b=curnode->number==str;break; case 2: b=curnode->name==str;break; default: return; } if(b) { i=0; pw->next=curnode->next; delete curnode; curnode=pw->next; } else { pw=curnode; curnode=curnode->next; } }

//当i=1是代表没有找到数据 if(i) { cout<<\┏━━━━━━━┓\ cout<<\┃没有匹配的数据┃\ cout<<\┗━━━━━━━┛\} else { cout<<\┏━━━━━━━┓\ cout<<\┃ 数据删除成功 ┃\ cout<<\┗━━━━━━━┛\

} curnode=head; while(curnode->next) { curnode=curnode->next; } cout<<\}

//////////////////////////////////////排序函数的实现 void student::compositor(int n,int m) { if(head->next==NULL) { cout<<\┏━━━━━━━━━━━┓\ cout<<\┃!这是一个空表不能排序!┃\ cout<<\┗━━━━━━━━━━━┛\ cout<<\ return; } if(head->next->next==NULL) { cout<<\┏━━━━━━━━━━━┓\ cout<<\┃!只有一条记录不用排序!┃\ cout<<\┗━━━━━━━━━━━┛\ cout<<\ return; } student *s,*p,*q,*r; r=head;

s=head->next; q=s;

p=q->next;

while(s!=NULL) { while(p!=NULL) { switch(n) { case 1: { if(m==1) { while(s->numbernumber)

} case 2: {

{

q->next=p->next; r->next=p; p->next=s; s=p; p=q->next; if(p==NULL) break; } } else { while(s->number>p->number) { q->next=p->next; r->next=p; p->next=s; s=p; p=q->next; if(p==NULL) break; } }

break;

if(m==1) { while(s->sumsum) { q->next=p->next; r->next=p; p->next=s; s=p; p=q->next; if(p==NULL) break; } } else { while(s->sum>p->sum) {

q->next=p->next; r->next=p; p->next=s; s=p; p=q->next; if(p==NULL) break; } } break; } case 3: { if(m==1) { while(s->aveave) { q->next=p->next; r->next=p; p->next=s; s=p; p=q->next; if(p==NULL) break; } } else { while(s->ave>p->ave) { q->next=p->next; r->next=p; p->next=s; s=p; p=q->next; if(p==NULL) break; } } break; } default: return; }

if(p==NULL)