f<<setw(7)<<english;
f<<setw(7)<<math;
f<<setw(7)<<c;
f<<setw(7)<<wl;
f<<setw(7)<<sum;
f<<setw(7)<<average<<endl; }
void STUDENT::Outputtwo(ofstream &f)
{f<<setw(5)<<cname;
f<<setw(5)<<num;
f<<setw(8)<<name;
f<<setw(5)<<sex<<endl;}
void CLASS::Add()
{cout<<"\n** 增加学生信息 **\n";
STUDENT *p=new STUDENT;
STUDENT *p2=SL;
while(p2->next)p2=p2->next;
p2->next=p;
p->Input();
}
void CLASS::Delete()
{
cout<<"\n** 删除学生 **\n";
char nterm[10];
char NCLASS[10];
char nname[10];
STUDENT *p1,*p2;
cout<<"学期:";
cin>>nterm;
cout<<"班级:";
cin>>NCLASS;
cout<<"姓名:";
cin>>nname;
if(!Find(nterm,NCLASS,nname,&p1,&p2))
{
cout<<"抱歉,指定的学生没有找到!\n";
}
else
{
p2->next=p1->next; //连接
delete p1;
cout<<"记录已经正确删除了!\n";
}
}
int CLASS::Find(char *nterm,char*NCLASS,char*nname,STUDENT **p1,STUDENT **p2)
{
*p1=SL->next;
*p2=SL;
while(*p1)
{
if(strcmp((*p1)->term,nterm)==0)
{ if(strcmp((*p1)->cname,NCLASS)==0)
if(strcmp((*p1)->name,nname)==0)
break;
else
{
*p2=*p1;
*p1=(*p1)->next;
}
else
{ *p2=*p1;
*p1=(*p1)->next;
}}
else
{*p2=*p1;
*p1=(*p1)->next;
}
}
return *p1?1:0;
}
int CLASS::Find2(char *nterm,char*NCLASS,char*id,STUDENT **p1,STUDENT **p2)
{
*p1=SL->next;
*p2=SL;
while(*p1)
{
{if(strcmp((*p1)->cname,NCLASS)==0)
if(strcmp((*p1)->num,id)==0)
break;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>