using namespace std; #include #include ///////// illustrating stl vectors void f(vector B) // used for test later ... { B[1] = 4; } int main() { vector A; vector B; // use a vector like a stack: A.push_back(1); A.push_back(2); A.push_back(3); A.push_back(4); cout << "the top of the stack has " << A.back() << endl; A.pop_back(); // deletes top element cout << "size of stack is now " << A.size() << endl; cout << "you can also access the \"front\" element: " << A.front() << endl; cout << "or even any element in the middle: " << A[1] << endl; // use a vector like an array: B.reserve(3); // pre-allocates memory for 3 elements B[0] = 3.14; B[1] = 2.78; B[2] = 0.6; for(int i=0;i instead, or simply implement your own lists. // Consult the online links to further STL docs for more info. I may // require you to learn some of these tools on your own. return 0; }