Created
September 16, 2016 15:40
-
-
Save AndyNovo/64b57087dccd5eb5ab58ccd85e0c43c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| int main() | |
| { | |
| vector<int> coll; // vector container for integer elements | |
| // append elements with values 1 to 6 | |
| for (int i=1; i<=6; ++i) { | |
| coll.push_back(i); | |
| } | |
| // print all elements followed by a space | |
| for (int i=0; i<coll.size(); ++i) { | |
| cout << coll[i] << ' '; | |
| } | |
| cout << endl; | |
| //example from http://www.josuttis.com/libbook/stl/vector1.cpp.html | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment