#include <vector>
#include <iostream>
#include <algorithm> // used for sort
using namespace std;
int main() {
int size = 10;
// empty vector of integers
vector<int> numbers;
// add items to the end of the vector
for (int i=0; i < size; ++i) {
numbers.push_back(i);
}
// access items from a vector
for (int i = 0; i < size; ++i) {
cout << "item at index " << i << ": " << numbers[i] << endl;
}
// sort a vector
sort(numbers.begin(), numbers.begin() + size);
for (int i = 0; i < size; ++i) {
cout << "item at index " << i << ": " << numbers[i] << endl;
}
return 0;
}