天外天-万年历

<< 2007-10 >>

Sun

Mon

Tue

Wen

Thu

Fri

Sat

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

最新评论

音乐

  • c++ []

    发布时间:2007-10-14 作者:li513531762 最后修改日期为:2007-10-14 返回首页

    #include<iostream.h>
    class point
    {
    protected:
    double x,y;
    public:
    point(){x=0;y=0;}
    point(double x1,double y1){x=x1;y=y1;}
    void show()
    {cout<<"点("<<x<<","<<y<<""<<endl;}
    };

    class zheng:public point
    {
    protected:
    double length,area;
    public:
    zheng(double x1,double y1,double l):point(x1,y1)
    {length=l;}
    void show()
    {
    point::show();
    cout<<"area="<<length*length<<endl;;
    }
    };
    class cubic:public zheng
    {
    protected:double V;
    public:
    cubic(double x2,double y2,double l):zheng(x2,y2,l)
    {};
    void show()
    {
    point::show();
    cout<<"V="<<length*length*length<<endl;
    }
    };

    void main()
    {
    zheng A(1,2,3);
    cubic B(2,3,3);
    A.show();
    B.show();
    }

  • 个人分类

  • 默认(2)