diff options
Diffstat (limited to 'sec3.4-vector_string_iterator.cpp')
-rw-r--r-- | sec3.4-vector_string_iterator.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sec3.4-vector_string_iterator.cpp b/sec3.4-vector_string_iterator.cpp new file mode 100644 index 0000000..23ddb83 --- /dev/null +++ b/sec3.4-vector_string_iterator.cpp @@ -0,0 +1,23 @@ +#include <iostream> +#include <string> +#include <vector> + +using std::string; +using std::vector; +using std::cin; +using std::cout; +using std::endl; + +int main(int argc, char **argv) +{ + string word; + vector<string> text; + + while (cin >> word) + text.push_back(word); + + for (vector<string>::const_iterator iter = text.begin(); iter != text.end(); ++iter) + cout << *iter << endl; + + return 0; +} |