摘要: http://download.microsoft.com/download/A/9/1/A91D6B2B-A798-47DF-9C7E-A97854B7DD18/VC.iso 阅读全文
posted @ 2012-07-03 22:38 dengyigod 阅读(455) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>#include <string>#include <algorithm>#include <functional>void main(){string str(" d df df ");string::iterator new_end = remove_if(str.begin(), str.end(), bind2nd(equal_to<char>(), ' '));str.erase(new_end, str 阅读全文
posted @ 2012-07-03 00:53 dengyigod 阅读(237) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/MikeZhang/archive/2012/03/24/MySplitFunCPP.html 阅读全文
posted @ 2012-07-03 00:52 dengyigod 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是100%)的需要。我们可以用 = 进行赋值操作,== 进行比较,+ 做串联(是不是很简单?)。我们尽可以把它看成是C++的基本数据类型。 好了,进入正题………首先,为了在我们的程序中使用string类型,我们必须包含头文件。如下: #include//注意这里不是string.h string.h是C字符串头文件1.声明一个C++字符串声明一个字符串变量很简单: string Str;这样我们就声明 阅读全文
posted @ 2012-07-03 00:51 dengyigod 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 这些天都在和文件的操作打交道。零零散散的见识了不少对文件的操作方法,所以先整理一下。以免要用的时候找不到。一:C语言中对文件的操作方法。c语言对文件的操作是通过FILE指针,通过fopen函数打开文件,通过fwrite函数向文件中写入数据FILE *fopen( const char *filename, const char *mode);其中filename是要打开的文件名,mode为打开的模式,mode的取值为r----只读。w------写入(每次打开时会先清空文件) a-----在文件的末尾添加r+------读写,文件必须存在 w+-----读写。如果文件不存在就自动创建a... 阅读全文
posted @ 2012-07-03 00:48 dengyigod 阅读(101) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#include <algorithm>#include <sstream>#include <vector>using namespace std;vector<string> split(const string& src, const string sp) ;int main() { string str("Hello,World"); //1.获取字符串的第一个字母 cout << "1.获取字 阅读全文
posted @ 2012-07-03 00:47 dengyigod 阅读(129) 评论(0) 推荐(0) 编辑