08 2015 档案

摘要:Struct和Class每一方面都是一样的,除了class中的成员默认为private,而struct中成员默认为public。下面代码中,struct和class将产生同样的结果:#include "iostream"using namespace std;struct A{private: in... 阅读全文
posted @ 2015-08-30 18:00 del_le 阅读(115) 评论(0) 推荐(0) 编辑
摘要:C++不是完全的面向对象语言,而是一个混合产品。如果一个函数被声明为friend,就意味着它不是这个类的成员函数,却可以修改该函数的私有成员,而且必须被列在该类的定义中,因此可以认为它是一个特权函数#include "iostream"#include "cstring"using namespac... 阅读全文
posted @ 2015-08-30 17:48 del_le 阅读(626) 评论(0) 推荐(0) 编辑
摘要:int CalcBit(int num)//计算num的位数{ int cnt=0; while(num/10 !=0) { num=num/10; cnt++; } cnt=cnt+1;//num的位数 return cnt;} 阅读全文
posted @ 2015-08-30 10:57 del_le 阅读(7432) 评论(0) 推荐(0) 编辑