1996: 类综合1:计算3同学的分数

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:0 通过:0

题目描述

设计 两个类(score, student)。用于保存学生的信息。

score类的成员变量为:

      float computer;
      float english;
      float mathematics;

student类的成员变量为:

     int number;
      char* name;
      score ascore;

主函数为:

void main()
{
      int numberi;
      char namei[20];
      float score1,score2,score3;
      student  aSA[size];
      for(int i=0;i<size;i++)
      {
           cout<<"please input the data of NO."<<i+1<<"student";
           cout<<"\nnumber:";cin>>numberi;
        cout<<"name:";cin>>namei;
        cout<<"score of computer:";cin>>score1;
        cout<<"score of english:";cin>>score2;
        cout<<"score of mathematics:";cin>>score3;
          aSA[i].modify(numberi,namei,score1,score2,score3);
      }
      cout<<"\n\n";
      cout<<setw(8)<<"学号"<<setw(8)<<"姓名"<<setw(8)<<"计算机"
           <<setw(8)<<"英语"<<setw(8)<<"数学"<<setw(8)<<"总分";
      cout<<endl;
      for(int j=0;j<size;j++)
           aSA[j].print();
      cout<<endl;
 }

输入格式

输入3位学生的基本信息,如下所示:

please input the data of NO.1student
number:9823201
name:chen
score of computer:89
score of english:88
score of mathematics:87
please input the data of NO.2student
number:9823202
name:li
score of computer:88
score of english:77
score of mathematics:66
please input the data of NO.3student
number:9823203
name:hu
score of computer:78
score of english:65
score of mathematics:98

输出格式

输出为:


    学号    姓名  计算机    英语    数学    总分

 9823201      chen    89      88      87     264
 9823202      li           88      77      66     231
 9823203      hu        78      65      98     241

输入样例 复制

9823201
chen
89
88
87
9823202
li
88
77
66
9823203
hu
78
65
98

输出样例 复制

    学号    姓名  计算机    英语    数学    总分

 9823201      chen    89      88      87     264
 9823202      li      88      77      66     231
 9823203      hu      78      65      98     241