随笔分类 - C++小知识
摘要:(1)如何在一个CString的字符串中,以","为分割点,提取子字符串 CString a="322,787,123";int n=a.Find(","); //查找第一个","的位置b=a.left(n); //将","左边的值取出给bint length=a.Delete(0,n); //找出
阅读全文
摘要:在对象使用之前将它初始化,对于无任何成员的内置类型,你必须手工完成此事。 例如: int x = 0; const char *text = " "; double d; std::cin >> d; //以input stream 的方式完成初始化 内置类型以外的任何其他东西,初始化责任落在构造函
阅读全文
摘要://#include "stdio.h" #include "iostream" #include "string" using namespace std; template <class T> void swap1(T &a,T &b){ T c; c = a; a = b; b = c; co
阅读全文
摘要:1、map是STL容器中的一种,属于关联性容器。以key value的形式存储。key必须唯一。如果重复则插入失败。插入后按照key默认排序。必须要先声明命名空间:using namespace std;2、例如:#include<map>#include<string>using namespac
阅读全文

浙公网安备 33010602011771号