摘要: 声明一个circle类,有数据成员Radius(半径float型),成员函数GetArea()计算圆的面积。在main 函数中声明一个circle类的对象c1,其半径为5.6。调用GetArea()函数计算c1的面积,并显示该计算 结果(cout<<"圆的面积:"<<c1.GetArea()<<en 阅读全文
posted @ 2021-02-10 18:48 bobo哥 阅读(336) 评论(2) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class Sample{ int n; static int sum;public: Sample(int x) { n = x; } void add() { sum += n; } void disp() 阅读全文
posted @ 2021-02-10 18:40 bobo哥 阅读(102) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class Sample{private: int x;public: Sample() {} Sample(int a) { x = a; } void disp() { cout << "x=" << x < 阅读全文
posted @ 2021-02-10 18:34 bobo哥 阅读(139) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream>using namespace std;class Sample{private: int x;public: Sample() {} Sample(int a) { x = a; } void disp() { cout << "x=" << x < 阅读全文
posted @ 2021-02-10 17:49 bobo哥 阅读(166) 评论(0) 推荐(0)