Answer:
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> numbers;
int input;
cin >> input;
// Read input until 0 is encountered
while (input != 0) {
numbers.push_back(input);
cin >> input;
}
// Get the last element of the vector
int n = numbers.back();
// Output the elements from index n to the end of the vector
for (int i = n; i < numbers.size(); i++) {
cout << numbers[i] << endl;
}
return 0;
}
Step-by-step explanation: