// Print Every Character in a String // First, we will fill the string with characters read from the // standard input. Then, we will print each character. #include #include // has EXIT_SUCCESS #include // has for_each() #include // Print the specified element. void print_element(const char c) { cout << c; return; } int main() { string v; // make a string of characters // Store characters from standard input in the string. char c; while (cin.get(c)) v += c; // grow string one larger, storing c // in the last position // Print the string's characters. for_each(v.begin(), v.end(), print_element); return EXIT_SUCCESS; }