导航

2016年4月13日

摘要: 13.44:编写标准库string类的简化版本,命名为String。你的类应该至少有一个默认构造函数和一个接受C 风格字符串指针参数的构造函数。使用allocator为你的String类分配所需内存 String.h头文件 主函数验证 阅读全文

posted @ 2016-04-13 20:21 CSU蛋李 阅读(187) 评论(0) 推荐(0)

摘要: C++primer 练习13.39 编写你自己版本的StrVec,包括自己版本的reserve,capacity(参见9.4节,第318页)和resize(参见9.3.5节,第314页) 13.40 为你的StrVec类添加一个构造函数,它接受一个initializer_list 阅读全文

posted @ 2016-04-13 19:33 CSU蛋李 阅读(336) 评论(0) 推荐(0)

摘要: #pragma once #include #include using namespace std; class Message { friend class Folder; friend void swap(Message &lhs, Message &rhs); public: explicit Message(const string &str=""):cont... 阅读全文

posted @ 2016-04-13 17:00 CSU蛋李 阅读(223) 评论(0) 推荐(0)

摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文

posted @ 2016-04-13 14:51 CSU蛋李 阅读(102) 评论(0) 推荐(0)

摘要: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 阅读全文

posted @ 2016-04-13 14:50 CSU蛋李 阅读(97) 评论(0) 推荐(0)

摘要: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 采用三 阅读全文

posted @ 2016-04-13 14:40 CSU蛋李 阅读(94) 评论(0) 推荐(0)