Obtain a substring
#include <iostream> #include <string> using namespace std; int main() { string str1("this is a test"); cout << " str1: " << str1 << endl; // Obtain a substring. str1 = str1.substr(5, 4); cout << str1 << "\n\n"; return 0; }