// Part2_vector.cpp : Defines the entry point for the console application. // #include #include #include using namespace std; int main() { vector v; //Creating a vector with name v that cotains integers v.push_back(3); //adding 3 as element to a vector v.push_back(2); //adding 2 as element to a vector v.push_back(1); for (auto i = 0; i < v.size(); i++) //printing element of a vector { cout << v[i] << endl; } for (auto i = v.begin(); i != v.end(); i++) //this is a concept of iterator, v.begin() return the iterator which points to the beginning of the vector { cout << *i << endl; //* - dereference operator that looks at what value is at the address i } for (auto i = v.rbegin(); i != v.rend(); i++) { cout << *i << endl; //reverse printing of element of a vector } system("pause"); return 0; }