cin>>place;
cout<<"\t\t 输入民族: ";
cin>>nation;
cout<<"\t\t 输入生日: ";
cin>>birth;
cout<<"\t\t 输入政治面貌: ";
cin>>party;
cout<<"\t\t 输入身份证号: ";
cin>>id;
cout<<"\t\t 输入高数分数: ";
cin>>score[0];
cout<<"\t\t 输入大学英语分数: ";
cin>>score[1];
cout<<"\t\t 输入面向对象程序设计分数:";
cin>>score[2];
cout<<"\t\t 输入大学物理分数:";
cin>>score[3];
cout<<"\t\t 输入数据结构分数:";
cin>>score[4];
cout<<"\t\t 输入马克思列宁主义哲学分数:";
cin>>score[5];
e=0;
else
}
{
cout<<"\t\t\t 无此类型性别!重新输入!"<
>number>>name>>sex>>place>>nation>>birth>>party>>id
>>score[0]>>score[1]>>score[2]>>score[3]>>score[4]>>score[5];
is.get();
}
void output()
{
cout<<"学生基本信息如下:"<<<" 民族:"<next=NULL; key=0; }
~school(){ delete head; }
void input();
void mend();
void del();
int find(student **p,int num,char *pn="^");
void found();
void show();
void count();
void save();
void begin();
void clear();
char mainmenu();
int getkey(){ return key;}
void setkey(int k){ key=k; }
private:
student *head;
int key;
};
//录入函数
void school::input()
{
student *p,*p2=NULL;
p=head;
int n;
while(p->next)
p=p->next;
while(n)
{
p2=new student;
p2->input();
p->next=p2;
p2->next=NULL;
p=p->next;
school::setkey(1);
cout<<"\t\t\t 按 1 继续,按 0 返回 : ";
cin>>n;
}
}
//子查找函数
int school::find(student **p1,int num,char *pn)
{
student *p;
p=head;
while(p->next)
{
(*p1)=p;
if( (p->next)->getnumber()==num||!strcmp( (p->next)->getname(),pn ) )
return 1;
p=p->next;
}
return 0;
}
//查找函数
void school::found()
{
student *p;
int num=-1,n=9;
char name[20]="^";
do
{
cout<<"\t\t1:按学号查找,2:按姓名查找: ";
cin>>n;
}while(n<1||n>2);
if(n==1)
{
cout<<"\t\t\t 输入学号: ";
cin>>num;
}
if(n==2)
{
cout<<"\t\t\t 输入姓名: ";
cin>>name;
}
if(!find(&p,num,name) )
{
cout<<"\t\t 找不到你要查找的内容!"<next)->output();
}
//删除函数
void school::del()
{
student *p,*p2;
int num;
cout<<"\t\t\t 输入学号: ";
cin>>num;
if( !find(&p,num,"^") )
{
cout<<"\t\t 找不到你要删除的内容!"<next)->output();
p2=p->next;
p->next=p2->next;
delete p2;
school::setkey(1);
}
//显示函数
void school::show()
{
student *p;
p=head;
while(p->next)
{
(p->next)->output();
p=p->next;
}
}
//修改函数
void school::mend()
{
student *p;
int num=-1,n;
char name[20]="^";
do
{
cout<<"\t\t1:按学号修改,2:按姓名修改: ";
cin>>n;
}while(n<1||n>2);
if(n==1)
{
cout<<"\t\t\t 输入学号: ";
cin>>num;
}
if(n==2)
{
cout<<"\t\t\t 输入姓名: ";
cin>>name;
}
if( !find(&p,num,name) )
{
cout<<"\t\t 找不到你要修改的内容!"<next)->output();
(p->next)->input();
school::setkey(1);
}
//保存函数
void school::save()
{
student *p;
p=head;
ofstream os("student.txt",ios::out);
if (school::getkey()==1)
{
while(p->next)
{
(p->next)->output(os);
p=p->next;
}
}
cout<<"\t\t\t 文件已保存! "<>num;
is.seekg(t);
if(num<0)
{
is.close();
return;
}
p2=new student;
p2->input(is);
p->next=p2;
p2->next=NULL;
p=p->next;
}
}
//清空函数
void school::clear()
{
student *p,*p2;
p=head->next;
while( p )
{
p2=p;
p=p->next;
delete p2;
}
}
//统计函数
void school::count()
{
student *p;
p=head;
int n=0;
double g[3]={0,0,0};
float j[3]={0,0,0};
while(p->next)
{
p=p->next;
n++;
for(int i=0;i<3;i++)
{
g[i]=g[i]+( p->getscore(i) );
(p->getscore(i) )>=60? j[i]++ : 0 ;
}
}
cout<<"\t\t\b\b\b\b 高数总分:"<