摘要:
inline size_t hashstring(const char* s){ unsigned long h = 0; for (; *s; ++s) { h = 5 * h + *s; } return (size_t)(h);} 阅读全文
posted @ 2020-08-19 13:39
莫水千流
阅读(102)
评论(0)
推荐(0)
摘要:
写的好棒!!!%%%粘来咯... 字符串匹配算法,是在实际工程中经常遇到的问题,也是各大公司笔试面试的常考题目。此算法通常输入为原字符串(string)和子串(pattern),要求返回子串在原字符串中首次出现的位置。比如原字符串为“ABCDEFG”,子串为“DEF”,则算法返回3。常见的算法包括: 阅读全文
posted @ 2020-08-19 09:14
莫水千流
阅读(349)
评论(0)
推荐(0)
摘要:
C++中读取文件可以采用几个函数分别为,_findfirst、_findnext、_findclose。其中还要借助结构体 struct _finddata_t,_finddata_t主要用来存储各种文件的信息。 struct _finddata64i32_t { unsigned attrib; 阅读全文
posted @ 2020-08-19 09:04
莫水千流
阅读(1237)
评论(1)
推荐(1)
摘要:
说明 bind1st() 和 bind2nd(),在 C++11 里已经 deprecated 了,建议使用新标准的 bind()。 下面先说明bind1st() 和 bind2nd()的用法,然后在说明bind()的用法。 头文件 #include <functional> 作用 bind1st( 阅读全文
posted @ 2020-08-19 06:47
莫水千流
阅读(1100)
评论(0)
推荐(1)