// pgm35 // using the C++ string class: substr, <, > // these functions DO NOT ALLOW YOU TO MODIFY A string // 11/23/2016 #include #include #include #include #include using namespace std; int main() { string sentence = "My inkjet printer is not working"; string sub; // first param is position to begin, second param is // length of substring to copy sub = sentence.substr(5, 8); cout << "sub is: " << sub << endl; cout << "sentence is: " << sentence << endl; // comparing strings. In general, this means alphabetical // ordering (exception: all uppercase are < lower case) string one = "apple"; string two = "banana"; if (one < two) cout << one << " is less than " << two << endl; else cout << two << " is less or equal to " << one << endl; return 0; }