Problem 1434. -- 类的设计(3)----Circle圆类

1434: 类的设计(3)----Circle圆类

Time Limit: 1 Sec  Memory Limit: 128 MB   64bit IO Format: %lld
Submitted: 1738  Accepted: 1082
[Submit][Status][Web Board]

Description

设计Circle圆类,成员数据包含半径radius,类型为double。根据给定的main函数设计必要的成员函数。main函数已给定,提交时只需要提交main函数外的代码部分。

int main()
{
    Circle c1;
    cout<<"C1: radius="<<c1.Get()<<endl;
    cout<<"    Circumference="<<c1.Circumference()<<endl;
    cout<<"    Square="<<c1.Square()<<endl;
    Circle c2(1);
    cout<<"C2: radius="<<c2.Get()<<endl;
    cout<<"    Circumference="<<c2.Circumference()<<endl;
    cout<<"    Square="<<c2.Square()<<endl;
    c1.Set(2);
    cout<<"C3: radius="<<c1.Get()<<endl;
    cout<<"    Circumference="<<c1.Circumference()<<endl;
    cout<<"    Square="<<c1.Square()<<endl;
    return 0;
}

Sample Output

C1: radius=0
    Circumference=0
    Square=0
C2: radius=1
    Circumference=6.28
    Square=3.14
C3: radius=2
    Circumference=12.56
    Square=12.56

[Submit][Status][Web Board]