2013年10月12日

递归法求阶乘

摘要: #include using namespace std;// 递归法求阶乘int funcfactorial(int a){ if (a> a; cout << funcfactorial(a)<<endl; return 0;} 阅读全文

posted @ 2013-10-12 20:14 Lingc· 阅读(229) 评论(0) 推荐(0) 编辑

利用引用访问私有数据成员

摘要: #includeusing namespace std;//引用访问私有数据成员class Test{private: int x,y;public: void setxy(int a ,int b) { x = a; y = b; } void getxy(int &px,int &py) { px = x;//相当于 &px = a; px就是a了! py = y; } void printxy() { cout << x <<endl; cout << y <<endl; }};int main(){ Test p; 阅读全文

posted @ 2013-10-12 17:30 Lingc· 阅读(393) 评论(0) 推荐(0) 编辑

导航

不知道不知道 知道不知道 知道知道 不知道知道。
天道酬勤,同志们共同努力!