72 - string substrings, swapping, and finding

#include 
#include 
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, and finding)