摘要: 1. 过程性编程和面向对象编程2. 抽象和类1. 使用类对象的程序都可以直接访问公有部分,但只能通过公有成员函数(或友元函数)来访问对象的私有成员2. 可以在类声明之外定义成员函数,并使其成为内联函数3. 类的构造函数和析构函数1. 接受一个参数的构造函数允许使用赋值语法将对象初始化为一个值4. t... 阅读全文
posted @ 2015-03-06 14:58 Azurewing 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1. 单独编译1.1 头文件中常包含的内容:函数原型使用#define或const定义的符号常量结构声明类声明模板声明内联声明1.2 只需将源代码文件加入到项目中,而不用加入头文件。这是因为用#include管理头文件。1.3 避免多次包含同一个头文件1 #ifndef COORDIN_H_2 #d... 阅读全文
posted @ 2015-03-05 13:09 Azurewing 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 代码: 1 class Solution { 2 public: 3 int atoi(string str) { 4 int num = 0; 5 int sign = 1; 6 const int n = str.size(); 7 ... 阅读全文
posted @ 2015-03-04 15:50 Azurewing 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 代码: 1 class Solution { 2 public: 3 void nextPermutation(vector &num) { 4 5 const auto first = num.begin(); 6 const auto last = nu... 阅读全文
posted @ 2015-03-04 15:25 Azurewing 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 代码:暴力算法 1 class Solution { 2 public: 3 int strStr(char *haystack, char *needle) { 4 if (!*needle) 5 return 0; 6 int al... 阅读全文
posted @ 2015-03-03 19:46 Azurewing 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 代码: 1 1 class Solution { 2 2 public: 3 3 int removeElement(int A[], int n, int elem) { 4 4 int index = 0; 5 5 for (int i = 0;... 阅读全文
posted @ 2015-03-03 10:25 Azurewing 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 代码:class Solution {public: bool isValid(string s) { string left = "([{"; string right = ")]}"; stack stk; for(auto c : ... 阅读全文
posted @ 2015-03-03 00:11 Azurewing 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 代码: 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 transform(s.begin(), s.end(), s.begin(), ::tolower); 5 auto lef... 阅读全文
posted @ 2015-03-02 22:58 Azurewing 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1. History of the C++ Standards1.1 History of the C++ StandardsC++98 -> C++03 -> TR1 -> C++11 -> C++14(书中没有,貌似是最新标准)1.2 Common Questions about the C++... 阅读全文
posted @ 2015-03-02 16:42 Azurewing 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 算法渣,现实基本都参考或者完全拷贝[戴方勤(soulmachine@gmail.com)]大神的leetcode题解,此处仅作刷题记录。 1 class Solution { 2 public: 3 vector > fourSum(vector &num, int target) ... 阅读全文
posted @ 2015-03-02 14:16 Azurewing 阅读(173) 评论(0) 推荐(0) 编辑