![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
FUNCTION
文章平均质量分 52
beecindy
hi
展开
-
文件操作
linux下面 A Demo written by camelrain /* the program find a file from current directory or your defined directory commond optinon [path]原创 2010-02-02 17:59:00 · 368 阅读 · 0 评论 -
10个重要的算法C语言实现源代码
包括拉格朗日,牛顿插值,高斯,龙贝格,牛顿迭代,牛顿-科特斯,雅克比,秦九昭,幂法,高斯塞德尔 都是转载的,而且都是没有经过测试的源代码,看看思路就行了,作为资料在这里保存一份下来。1.拉格朗日插值多项式 ,用于离散数据的拟合C/C++ code#include #include #include float lagrange(float *x,float *y,float xx,int n) /转载 2011-11-28 23:20:59 · 891 阅读 · 0 评论 -
algorithm 函数表 C++
ccumlate : iterator 对标志的序列中的元素之和,加到一个由 init 指定的初始值上。重载的版本不再做加法,而是传进来的二元操作符被应用到元素上。adjacent_different :创建一个新序列,该序列的每个新值都代表了当前元素与上一个元素的差。重载版本用转载 2011-07-28 09:56:52 · 454 阅读 · 0 评论 -
Unicode下wstring(wchar_t*)和string(char*)互相转换
<br />#include using namespace std; //将string转换成wstring wstring string2wstring(string str) { wstring result; //获取缓冲区大小,并申请空间,缓冲区大小按字符计算 int len = MultiByteToWideChar(CP_ACP, 0, str.c_str(), str.size(), NU转载 2011-05-03 23:53:00 · 770 阅读 · 0 评论 -
防止出现中文半个汉字
<br />int test(const std::string & str, int len){ for (int i = 0 ; i < str.length() ;) { if (str[i] & 0x80) { i += 2; if (i > len) return i - 2; } else {原创 2011-05-04 09:27:00 · 468 阅读 · 0 评论 -
c++基本类型最大最小值
numeric_limits::min();numeric_limits::max();原创 2010-03-26 18:13:00 · 316 阅读 · 0 评论 -
产生随机数
srand(unsigned(time(NULL)));for (int i = 0; i < _k; i++){int temp = rand()%(_coordCount);//产生随机数_clusterAssignments[temp] = i; //记录第temp个资料属于第i个聚类_clusters[i] = new Cluster(temp,_coordinates原创 2010-03-26 18:12:00 · 286 阅读 · 0 评论 -
遍历文件夹下的所有文件
typedef vector pathlist;pathlist pl;void iteratorPath(string path){_finddata_t FindData ;intptr_t hFile;pl.clear();char FindPath[1024];char FullName[1024];int pathlen = (int)strlen(原创 2010-03-26 18:31:00 · 415 阅读 · 0 评论 -
C语言字符替换
方法一:char *replace(char *source, char *sub, char *rep){char *result;/*pc1 是复制到结果result的扫描指针*//*pc2 是扫描 source 的辅助指针*//*pc3 寻找子串时,为检查变化中的source是否与子串相等,是指向sub的扫描指针 *//*找到匹配后,为了复制到结果串,是指向rep原创 2010-03-26 18:24:00 · 4257 阅读 · 1 评论 -
string.replace
#include #include using namespace std; string& replace_all(string& str,const string& old_value,const string& new_value) { while(true) { string::size_type原创 2010-03-18 11:45:00 · 531 阅读 · 0 评论 -
token
void Kmeans::split_bychar(const string& str, vector& vec, const char separator){ assert(vec.empty()); string::size_type pos1 = 0, pos2 = 0; string word; while((pos2 = str.find_first_of(separ原创 2009-12-16 10:05:00 · 319 阅读 · 0 评论 -
string与其它类型转换
template std::string dtos(T value){ std::stringstream ss; ss << value; return ss.str();}template T stod(const string& value) { stringstream strStream(value);原创 2009-12-15 23:32:00 · 290 阅读 · 0 评论 -
宽字符处理函数与窄字符处理函数对应表
字符分类: 宽字符函数普通C函数描述 iswalnum() isalnum() 测试字符是否为数字或字母 iswalpha() isalpha() 测试字符是否是字母 iswcntrl() iscntrl() 测试字符是否是控制符 iswdigit() isdigit() 测试字符是否为数字 iswgraph() isgraph() 测试字符是否是可见字符 is转载 2011-12-14 17:04:02 · 359 阅读 · 0 评论