原创 HDU ACMA 1025 最小遞增序列, 二分

 系統好坑, 全局變量s我開始用的i和局部變量一樣,, 然後就一直通過不了。。 後來改成S就好了。    參考:http://www.cnblogs.com/liyukuneed/archive/2013/05/26/3090402.ht

原创 Explicit Constructors(顯式構造函數)

按照默認規定,只有一個參數的構造函數也定義了一個隱式轉換,將該構造函數對應數據類型的數據轉換爲該類對象,如下面所示: class String { String ( const char* p ); // 用C風格的字符串p作爲初始

原创 new, delete 的用法

當然容器需要重新非配內存時,需要一次爲許多元素分配內存, new是在堆區開闢空間,返回地址。 int *p = new int[get_size()]; (無初始化,string 都OK) int *p = new int[get_siz

原创 *p++ *++p *(p++) *(++p)

注意 : 有括號沒括號其實一樣 #include <stdio.h> int main(){ char *p1 = "bm"; char *p2 = "bm"; char *p3 = "bm

原创 sscanf() cin.getline(buf,size) getline(cin,str)

sscanf() 在stdio.h cin.getline() iostream getline string.   馬克一下,用得少怕忘

原创 LINUX 的system()函數

#include <stdlib.h> int system(const char *string); 例:在~/myprogram/目錄下有shell腳本test.sh,內容爲   #!bin/bash   #test.sh

原创 函數模板 和類模板

轉自:http://blog.sina.com.cn/s/blog_913c070a0100zuah.html 還是例子說話。 函數模板: template<class T> max(const T a, const T b) {

原创 char ,unsigned char 還有位移 >> <<

>> << 對於有符號的用算術運算, 無符號的用邏輯運算。 << 左移算數邏輯都一樣 高位全去掉(符號位也不保留),低位補0. >>右移有點不同,算術的話高位會補符號位,10000001 >> 2   =11100001        

原创 unordered_map -

unordered_map - [c++學習] 版權聲明:轉載時請以超鏈接形式標明文章原始出處和作者信息及本聲明http://www.blogbus.com/wewe39-logs/121389636.html 同事告訴我用un

原创 static 全解

原文地址:http://blog.csdn.net/caiqinghua0201/article/details/6076333 1. 問題產生 #if 1 typedef double Unit #else struct Unit {

原创 關鍵字聲明extern

都在函數外,全局聲明時: 1,extern int a;        僅聲明,而沒有定義a, 還沒爲a分配存儲空間 2,extern int a = 0; 錯誤, 此時不要定義. 用G++ 編譯不會報錯,但是不能編譯出來的文件不能執行.

原创 虛基類(虛繼承) 原理

原文地址:點擊打開鏈接 不讓轉載~ 留個地址

原创 靜態函數,instance

#include <iostream> using namespace std; class Config{ public: void set_a(int _a) {a = _a;} void set_b(int _b)

原创 彙編指令~

傳送門:http://www.cnblogs.com/lxgeek/archive/2011/01/01/1923738.html

原创 二叉樹 非遞歸遍歷

#include <iostream> #include <stack> #include <assert.h> struct node{ node(int i = 0):val(i),lch(NULL),rch(NULL){}; i