C++
文章平均质量分 72
sorrowllj
这个作者很懒,什么都没留下…
展开
-
查找一个String 字符串的某个值,然后替换
大致的思路,先从头到尾扫描下整个字符串,得到有多少个需要被替换的目标字符串,然后通过 find() 和replace() 两个函数将其替换。 但是感觉如果这种处理方式,对一个非常巨大的字符串会耗费相当大的时间,暂时没想出什么好的方法。#include "iostream" #include "string" using namespace std; string findtoReplace(s原创 2015-05-26 12:29:38 · 1163 阅读 · 0 评论 -
两个日期之间差
给两个日期格式为x'x'x'x/xx/xx的时间,计算出两个日期的差值,借鉴了一个博客的代码,原地址搜不到了。 #include "iostream" #include "string" #include using namespace std; bool IsLeap(int year) { return (year % 4 ==0 || year % 400 ==0) &&原创 2015-06-16 15:49:04 · 213 阅读 · 0 评论