Problem 1438. -- 类的设计(7)---学生类Student

1438: 类的设计(7)---学生类Student

Time Limit: 10 Sec  Memory Limit: 65535 MB   64bit IO Format: %lld
Submitted: 1646  Accepted: 900
[Submit][Status][Web Board]

Description

设计学生类Student,成员数据包括学号(int Id)、姓名(char name[9])成绩(int score)。根据给定的main函数设计必要的成员函数。main函数已给定,提交时只需要提交main函数外的代码部分。

int main()
{
    Student s1,s2("张三",100,85);
    cout<<"student1:"<<s1.GetName()<<"-"<<s1.GetId()<<"-"<<s1.GetScore()<<endl;
    cout<<"student2:"<<s2.GetName()<<"-"<<s2.GetId()<<"-"<<s2.GetScore()<<endl;
    s1.Set("李四",21,99);
    s2.Set("王五",1201,75);
    cout<<"student3:"<<s1.GetName()<<"-"<<s1.GetId()<<"-"<<s1.GetScore()<<endl;
    cout<<"student4:"<<s2.GetName()<<"-"<<s2.GetId()<<"-"<<s2.GetScore()<<endl;
    return 0;
}

Sample Output

student1:NULL-0-0
student2:张三-100-85
student3:李四-21-99
student4:王五-1201-75

[Submit][Status][Web Board]