1、#include “stdafx.h“#include#include#include#include#define max 10000using namespace std;class Indexpublic:float math,english,chinese,ave,sum;char name8;int num;tempmax;class Student /定义学生类public:float math,english,chinese,ave,sum;char name8;int num;Student *next;void Createlist(Student * s=new Stude
2、nt; int a=1; while ( a=1) couts-num;couts-name; couts-math;couts-english;couts-chinese;s-sum=0;s-ave=0; if ( head = NULL ) head = s ; else p-next = s ; p = s ; s = new Student ; couta; p-next = NULL; delete s; return ; int m=0;index(Student *head,Index temp) Student *p; p=head;while(p!=NULL)tempm.nu
3、m=p-num;strcpy(tempm.name,p-name);tempm.math=p-math;tempm.english=p-english;tempm.chinese=p-chinese;tempm.sum=p-sum;tempm.ave=p-ave;p=p-next;m+;return 0;void count(Index temp) /计算总成绩和平均成绩int i;for(i=0;inext!=NULL)p=p-next;s=new Student; int a=1; while ( a=1) couts-num;couts-name; couts-math;couts-en
4、glish;couts-chinese;s-sum=0;s-ave=0; if ( head = NULL ) head = s ; else p-next = s ; p = s ; tempm.num=s-num;strcpy(tempm.name,s-name);tempm.math=s-math;tempm.english=s-english;tempm.chinese=s-chinese;tempm.sum=s-sum;tempm.ave=s-ave;m+;s = new Student ; couta; p-next = NULL; delete s; return ; Delet
5、e (Student *head,int key) /删除信息Student *p,*q;p=head;while(p!=NULL) if(p-num!=key)p=p-next;else break;q=head;while(q-next!=p)q=q-next;q-next=p-next;m-;delete p;couti;while(i8) /限制输入的取值范围couti;coutj;switch(j) case 1:sortsum(temp);break;case 2:sortave(temp);break;case 3:sortmath(temp);break;case 4:sortenglish(temp);break;case 5:sortchinese(temp);break;case 0:break;break;case 5: couta;searchnum(temp,a);break;case 6: coutname;searchname(temp,name);break;case 7: enter(head,temp);break;case 8:couta;Delete(head,a);break;case 0: cout“本次处理结束,再见!“endl;flag=0;return 0;