1// string::substr
2#include <iostream>
3#include <string>
4using namespace std;
5
6int main ()
7{
8 string str="We think in generalities, but we live in details.";
9 // quoting Alfred N. Whitehead
10 string str2, str3;
11 size_t pos;
12
13 str2 = str.substr (12,12); // "generalities"
14
15 pos = str.find("live"); // position of "live" in str
16 str3 = str.substr (pos); // get from "live" to the end
17
18 cout << str2 << ' ' << str3 << endl;
19
20 return 0;
21}
22