/*--- quick demo of string class substr method by: Sharon Tuttle last modified: 2024-11-01 ---*/ #include <cstdlib> #include <iostream> #include <string> #include <cmath> using namespace std; /*--- quick demo of the string class substr method ---*/ int main() { cout << boolalpha; cout << endl; cout << "*** substr playing ***" << endl; const string GREETING = "Hello!"; cout << endl; cout << "string constant GREETING has the value: " << GREETING << endl; cout << endl; cout << "Start at position 1 and grab 3 characters: " << endl << GREETING.substr(1, 3) << endl; cout << "Start at position 2 and grab all to the end: " << endl << GREETING.substr(2) << endl; return EXIT_SUCCESS; }