自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 (小米笔试)打乱字符串还原

#include #include int need[10][26]; void init() { char str[10][6] = { "ZERO","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE" }; int i, j; for (i = 0; i < 10; i++) { for (j = 0;

2016-09-23 21:56:01 2279

原创 Item09 绝不在构造和析构过程调用virtual函数

//Item09 绝不在构造和析构过程调用virtual函数 #include class base { public: base() { printf("base\n"); f(); } virtual void f() = 0 { printf("base::f\n"); } }; class drived :public base { public: drived()

2016-09-21 22:32:51 267

原创 strcpy函数

#include #include /* attention: 1.检查代码的健壮性。(判断两个指针是否为空) 2.NULL可以写在左边,防止少写=。 3.保存头指针是为了链式调用 ex:strlen(strcpy(a,b)); */ char *strcpy1(char *dest, char *src) { assert((dest != NULL) && (src != NULL)

2016-09-21 22:32:14 692

原创 关于重载赋值操作符需要返回引用

#include /* 如果赋值操作符不返回引用代码也能编译通过 但会增加调用copy构造函数的开销(因为返回局部对象会调用拷贝构造函数)。 返回引用的话能减少调用copy构造函数 (effective Item10) */ class A { public: A &operator=(const A& rhs) { printf("operator:%d\n", this-

2016-09-21 21:04:06 1363

原创 函数模板全特化与特殊的偏特化

//类模板的全特化和偏特化 #include #include template void f(T1 a1, T2 a2) { std::cout << "function template" << std::endl; std::cout << a1 << std::endl; std::cout << a2 << std::endl; } template <> void f(dou

2016-09-21 19:17:24 515

原创 类模板的全特化和偏特化

#include #include template class A { public: A(T1 self_str1,T2 self_str2) { printf("类模板:\n"); std::cout << self_str1 << std::endl; std::cout << self_str2 << std::endl; printf("\n"); } ~A(

2016-09-21 16:29:29 1250

原创 虚函数调用示例程序

#include class base { public: base() { f(); printf("base\n"); } virtual void f() { printf("base::f()\n"); } virtual void t() { printf("base::t()\n"); f(); } }; class subtype:public ba

2016-09-19 21:55:25 330

原创 初识bitset

#include using namespace std; /* 不够32,使用无符号 int 超过32,每多一个需要在后面添加一个无符号long long 所以后面递增8 */ int main() { bitset bit; bitset bit2; printf("32bit_length:%d\n",sizeof(bit));//4 8 16 24 32 40 printf

2016-09-19 21:07:58 282

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除