
函数
soloier
这个作者很懒,什么都没留下…
展开
-
next_permutation函数 in c++
C++ STL中提供了std::next_permutation与std::prev_permutation可以获取数字或者是字符的全排列,其中std::next_permutation提供升序、std::prev_permutation提供降序。1.std::next_permutation函数原型template <class BidirectionalIterator> bool next_翻译 2016-05-11 15:53:56 · 308 阅读 · 1 评论 -
c++ find 函数
寻找字符串(不能是字符数组)的子串,如果存在返回首次出现的位置(第一个字符)否则返回-1 s1.find(s2) 表示 子串s2在第一次出现s1的位置。样例string s1 = "Rey Dennis Steckler"; string s2 = "Dennis"; string s3 = "Dennis Steckler"; f=s2.find(s1);原创 2016-05-11 17:28:45 · 522 阅读 · 0 评论 -
C++中substr函数的用法
#include<string> #include<iostream> using namespace std; main() { string s("12345asdf"); string a=s.substr(0,5); //获得字符串s中 从第0位开始的长度为5的字符串//默认时的长度为从开始位置到尾 cout<<a<<endl; } 输出结果为: 12345转载 2016-05-20 08:28:08 · 518 阅读 · 0 评论