原创 win32 console
win32 project 1、int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, i
原创 數組 尋找數
數組行列都是非遞減#include <stdio.h> #include <iostream> #include <fstream> using namespace std; bool Find(int *martrix, int r
原创 UglyNumber
#include <stdio.h> #include <iostream> using namespace std; //只包含因子2、3和5的數稱作醜數(Ugly Number) bool IsUgly(int number) {
原创 圖的遍歷- 圖內多環 多連通圖問題
http://www.cnblogs.com/dolphin0520/archive/2011/07/13/2105236.html 遞歸 非遞歸(用棧) 圖的遍歷有兩種遍歷方式:深度優先遍歷(depth-first search
原创 itoa
#include <stdio.h> #include <iostream> using namespace std; //整形 double myItoa(const char *pChar) { //空指針 if(pChar
原创 類 醜數
#include <queue> #include<iostream> using namespace std; void main() { queue<int>triqueue; queue<int>fivqueue; qu
原创 queue
#include <stdio.h> #include <iostream> using namespace std; typedef struct _node { int data; _node *next; }Node
原创 動態規劃解最長公共子序列問題
http://blog.csdn.net/yysdsyl/article/details/4226630 動態規劃法 經常會遇到複雜問題不能簡單地分解成幾個子問題,而會分解出一系列的子問題。簡單地採用把大問題分解成子問題,並綜合子問
原创 LIB和DLL的區別與使用
共有兩種庫: 一種是LIB包含了函數所在的DLL文件和文件中函數位置的信息(入口),代碼由運行時加載在進程空間中的DLL提供,稱爲動態鏈接庫dynamic link library。 一種是LIB包含函數代碼本身,在編譯時直接將代碼加入
原创 C++編程學習50個經典網站 強力推薦
http://blog.csdn.net/xiaowall/article/details/7757806 C/C++是最主要的編程語言。這裏列出了50名優秀網站和網頁清單,這些網站提供c/c++源代碼。這份清單提供了源代碼的鏈接以及它們
原创 C++ stack棧 樹建立
stack<int>mystack; for (int i = 0; i< 10; i++) { mystack.push(i); } while(!(mystack.empty())) { int data = my
原创 面試積累日誌
異常處理,怎麼處理 一種稱爲"終止模型"(它是Java與C++所支持的模型).在這種模型中,將假設錯誤非常關鍵,將以致於程序無法返回到異常發生的地方繼續執行.一旦異常被拋出,就表明錯誤已無法挽回,也不能回來繼續執行. 另一種稱爲"
原创 生產者消費者
#include <windows.h> #include <iostream> const unsigned short SIZE_OF_BUFFER = 10; //緩衝區長度 unsigned
原创 利用boost提供的庫構建讀寫鎖與互斥鎖
http://hi.baidu.com/cpuramdisk/item/3fcd94cc6d05c53198b498f0 boost庫中提供了的mutex類與lock類,通過組合可以輕易的構建讀寫鎖與互斥鎖。 一種簡易的構建方法如下: 首
原创 簡單括號匹配code
#include<stdio.h> #define MAX 100 int match(char *str) { char stack[MAX],*p=stack; while(*str) { switch(*str) {