摘要: 1 #include 2 using namespace std; 3 //class String 4 //{ 5 //public: 6 // String(const char *str = NULL); 7 // 普通构造函数 // String(const String &other); 8 // 拷贝构造函数 9 // ~ String(void); // 析构函数 10 // String & operate =(const String &other); // 赋值函数 11 //private: 12 // char *m_data; 13 // 用于 阅读全文
posted @ 2013-08-20 23:10 cheshulin 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 mapmapm; 7 mapm.insert(pair(0,200)); 8 mapm.insert(pair(1,300)); 9 mapm.insert(pair(2,400));10 mapm[3]=500;11 map::iterator it;12 for (it=mapm.begin();it!=mapm.end();++it)13 {14 coutfirstsecond... 阅读全文
posted @ 2013-08-20 23:09 cheshulin 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 //true不交换 false交换,sort默认是升序。此程序为降序 8 template 9 bool cmp(const T x,const T y)10 {11 if (x>y) return 1;12 else return 0;13 }14 int main()15 {16 vectorvecm;17 vecm.push_back(3);18 vecm.push_back(4);19 ... 阅读全文
posted @ 2013-08-20 23:08 cheshulin 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 比较好的介绍:http://www.cnblogs.com/gaojun/archive/2010/09/11/1824016.html 阅读全文
posted @ 2013-08-20 22:21 cheshulin 阅读(158) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;template bool Make1DArray(T *x,int num){ x=new int [num]; if (NULL!=x) { return true; } return false; }template void Delete1DArray(T *x){ if (NULL==x) { return; } delete []x; x=NULL; }template bool Make2DArray(T **x,int rows,in... 阅读全文
posted @ 2013-08-20 16:55 cheshulin 阅读(192) 评论(0) 推荐(0) 编辑