Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int n;
- vector<int> a;
- cin >> n;
- for (int i = 0; i < n; i++)
- a.push_back(i);
- cout << "a contains: ";
- for (size_t i = 0; i < a.size(); i++)
- cout << a[i] << ' ';
- cout << endl;
- for (int i = 0; i < n - 1; i++)
- a[i] += a[i + 1];
- a.erase(a.end() - 1);
- cout << "a contains: ";
- for (size_t i = 0; i < a.size(); i++)
- cout << a[i] << ' ';
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement