/* * Example of using the boost library * Run this on attu. */ #include #include #include #include using namespace std; int main(int argc, char **argv) { string input; cout << "Hello, let's play the echo game until you end with '.'" << endl; // Keep receiving input until the user ends a line with a period. while (!boost::ends_with(input, ".")) { cin >> input; // Read a line from the user // Split the line into words vector words; // split by spaces, token_compress_on merges adjacent separators // (i.e. 2+ spaces in a row) boost::split(words, input, boost::is_any_of(" "), boost::token_compress_on); for (string word: words) { boost::to_upper(word); // Make it upper case cout << word << "\t"; boost::to_lower(word); // Make it lower case cout << word << endl; } } cout << "I see a period..." << endl; cout << "You typed a sentence! K... BYE!" << endl; }