C/C++语言知识
QiHang_QiHang
这个作者很懒,什么都没留下…
展开
-
C++中string.find()函数与string::npos 理解
先看一种很多人日常使用错误方式string str("hello world");int pos=str.find_first_of("h");if(pos!=string::npos) // 或者 if(pos!=-1) {......// 查找到了} //不存在是find返回-1这样的使用,结果是正常的,但并没有很好的理解string find函数的返回类型和st转载 2017-09-18 20:34:38 · 850 阅读 · 0 评论 -
string里find()函数,判断字符串是否包含某个子串
使用 string 的 find 成员函数。 #include #include using namespace std;int main(){string str = "afdsdfs_hello_sdfas#@!";string str1 = "hello";string::size_type idx = str.find( str1 );if ( idx != stri原创 2017-11-19 13:28:49 · 4911 阅读 · 0 评论 -
__int128
__int128 getmax(__int128 a,__int128 b){ if (a>b) return(a);else return(b); } void print(__int128 x){ if (x==0) return; if (x) print(x/10); putchar(x%10+'0'); }...原创 2018-09-05 20:41:48 · 918 阅读 · 0 评论