题目描述

Write a program with a class animal. Inside it define a name and an age variables, and set_value() function. Then create two bases variables Zebra and Dolphin which write a message telling the age, the name and giving some extra information (e.g. place of origin).


输入格式


输出格式


样例数据

输入

Zebra
3
Afican
Dolphin
5
swimming

输出

Zebra
3
Afican
Dolphin
5
swimming

备注

The main function is provided, you only need to complete the Animal Class:

int main(){
    int age;
    string name, extra;
    cin>>name>>age>>extra;
    Animal animal(name,age,extra);
    cout<<animal.showName()<<endl;
    cout<<animal.showAge()<<endl;
    cout<<animal.showExtra()<<endl;
    cin>>name>>age>>extra;
    animal.setAge(age);
    animal.setName(name);
    animal.setExtra(extra);
    cout<<animal.showName()<<endl;
    cout<<animal.showAge()<<endl;
    cout<<animal.showExtra()<<endl;
}

操作

评测记录

优秀代码

信息

时间限制: 1s
内存限制: 128MB
评测模式: Normal

题解