需求分析 功能描述 总体设计
aver+=temp->outgrade(i); temp=temp->next; }
cout<<aver/totoal<<endl; }
void list::ev(int i)
{ int a=0,b=0,c=0,d=0,e=0,f=0; student *temp=first;while(temp!=0) {switch((int)temp->outgrade(i)/10) {
case 10:a++;break;case 9:a++;break; case 8:b++;break;case 7:c++;break; case 6:d++;break;case 5:e++;break; default:f++; }
temp=temp->next; }
cout<<"100-90的人数:"<<a<<" 89-80的人数:"<<b<<" 79-70的人数:"<<c <<" 69-60的人数:"<<d<<" 59-50的人数:"<<e<<" 50以下的人数:"<<f <<" 及格的人数:"<<(a+b+c+d)<<" 不及格的人数:"<<(e+f)<<endl; }
void list::search(char s[10],int n) {
student *temp=first;for(;temp!=NULL;temp=temp->next) if(strcmp(temp->outname(),s)==0)temp->intgrade(n); }
void list::search1(char s[20],int n) {
student *temp=first;for(;temp!=NULL;temp=temp->next) if(strcmp(temp->outid(),s)==0)temp->intgrade(n); }
void list::outsum(char *n) {
if(first==0) {cout<<"无数据!"<<endl;return;}
student *temp=first;for(;temp!=NULL;temp=temp->next) if(strcmp(temp->outname(),n)==0) {
cout<<setw(8)<<"学号"<<setw(8)<<"姓名"<<setw(8)<<"性别"<<setw(8)<<"总成绩"<<
setw(10)<<"平均成绩"<<"\n";