// Print Every Character in a Vector // First, we will fill the vector 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() { vector v; // make a vector of characters // Store characters from standard input in the vector. char c; while (cin.get(c)) v.push_back(c); // grow vector one larger, storing c // in the last position // Print the vector's characters. for_each(v.begin(), v.end(), print_element); return EXIT_SUCCESS; }