摘要: //编写类的构造函数、析构函数和赋值函数class String{public: String(const char *str=NULL);//普通构造函数 String(const String &other);//拷贝构造函数 ~String();//析构函数 String &operate=(... 阅读全文
posted @ 2015-11-22 20:55 del_le 阅读(325) 评论(0) 推荐(0) 编辑
摘要: //通过使用IP Helpers API获取本地网络适配器信息//获取信息包括:网络适配器名、网络适配器描述、MAC地址、IP地址、子网掩码、网关、是否启动DHCP#include "stdafx.h"#include "iostream"#include "winsock2.h"#include ... 阅读全文
posted @ 2015-11-18 23:18 del_le 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑