04 2012 档案

摘要:今天在陈皓的博客看到这篇美文《C++虚函数表解析》(http://blog.csdn.net/haoel/article/details/1948051),并自己也“COPY”这样一份代码,以加深印象。#include <iostream>using namespace std;class Base1{public: virtual void f() { cout << "Base1::f" << endl; } virtual void g() { cout << "Base1::g" << 阅读全文
posted @ 2012-04-26 16:28 木愚 阅读(191) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;/* 快速排序** 思想:采用了分治策略,选用数组任一记录(一般为第一个)为Pivot** 根据这个Pivot,将数组分为左、右两个较小的子区间,且左边记录的关键字** 均小于等于Pivot的关键字,右边记录的关键字均大于等于Pivot的关键字** 以此思想递归之。** 注:Pivot可翻译为支点*/int a[] = { 49, 38, 65, 97, 76, 13, 27, 49 };void swap( int & lValue, int & rValue ){ int temp = 阅读全文
posted @ 2012-04-25 23:48 木愚 阅读(209) 评论(0) 推荐(0)
摘要:#include <iostream>using namespace std;void main(){ __try { cout << "__try" << endl; } __finally { cout << "__finally" << endl; } return;}输出:对于这个用法,可用于资源清理中。 阅读全文
posted @ 2012-04-13 10:06 木愚 阅读(147) 评论(0) 推荐(0)