C++课程设计学生成绩管理系统样三.docVIP

  • 50
  • 0
  • 约 14页
  • 2016-05-23 发布于浙江
  • 举报
C课程设计学生成绩管理系统样三

#includeiostream.h #includestring.h class STU{ public: long int xh; char xm[20],xb[20],jg[20]; float c,eng,phy; STU *next; friend class BJ; }; class BJ{ public: STU *Input(int n){ STU *p,*pend,*h=0; int i=0; if(n1)return 0; cout学号 姓名 性别 籍贯 VC++成绩 英语成绩 物理成绩endl; while(in){ p=new STU; cin(*p).xh(*p).xm(*p).xb(*p).jg(*p).c(*p).eng(*p).phy; (*p).next=0; if(h==0){h=p;pend=p;} else{pend-next=p;pend=p;} i++; }return h; } void calculate(STU *h,int n); void search(STU *h); void scoreswap(float a,float b); void intswap(long int a,long int b); void sort(STU *h,int a,int n); void deletestudent(STU *h,int data); void scholar(STU *h,int n); void shxs(STU *h,int n); void print(STU *h); void welcome(); void Introduction(); }; STU *Input(int n){ STU *p,*pend,*h=0; int i=0; if(n1)return 0; cout学号 姓名 性别 籍贯 VC++成绩 英语成绩 物理成绩endl; while(in){ p=new STU; cin(*p).xh(*p).xm(*p).xb(*p).jg(*p).c(*p).eng(*p).phy; (*p).next=0; if(h==0){h=p;pend=p;} else{pend-next=p;pend=p;} i++; }return h; } void BJ::calculate(STU *h,int n){ float S[20],aver[20],aver1=0,aver2=0,aver3=0,MAX,max1,max2,max3; float s1[20],s2[20],s3[20]; STU *p; p=h; for(int i=0;in;i++){ S[i]=(*p).c+(*p).eng+(*p).phy; aver[i]=S[i]/3; p=(*p).next; } for(p=h,i=0;in;i++){ aver1+=(*p).c; aver2+=(*p).eng; aver3+=(*p).phy; p=(*p).next; } aver1=aver1/n; aver2=aver2/n; aver3=aver3/n; for(p=h,i=0;in;i++){s1[i]=(*p).c;s2[i]=(*p).c;s3[i]=(*p).phy;p=(*p).next;} MAX=0;max1=0;max2=0;max3=0; for(i=0;in;i++){ if(MAXS[i])MAX=S[i]; if(max1s1[i])max1=s1[i]; if(max2s2[i])max2=s2[i]; if(max3s3[i])max3=s3[i]; } cout总成绩最高的学生:\n; for(p=h,i=0;in;i++){ if(MAX==S[i]) cout(*p).xh\t(*p).xm\tMAXendl; p=(*p).next; } coutVC++成绩最高的学生:\n; for(p=h,i

文档评论(0)

1亿VIP精品文档

相关文档