美文网首页
72 - string substrings, swapping

72 - string substrings, swapping

作者: 社交帐号直接注册 | 来源:发表于2018-01-10 15:37 被阅读0次
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s1("omg i think i am ppreggy!");
    cout << s1.substr(17,7) << endl;

    string one("apple  ");
    string two("beans  ");
    cout << one << two << endl;
    one.swap(two);
    cout << one << two << endl;

    string s2("ham is spam on i ko");
    cout << s2.find("s") << endl;
    cout << s2.rfind("s") << endl;
}

相关文章

网友评论

      本文标题:72 - string substrings, swapping

      本文链接:https://www.haomeiwen.com/subject/lguonxtx.html