C++ Help Integers are read from input and stored into a vector until 0 is read. Output the elements from index n to the last index of the vector, where n is specified by the vector's last element. End each number with a newline. Ex: If the input is 7 12 18 2 0, the vector's last element is 2. Thus, the output is: 18 2 Note: The input has at least three integers, and the vector's last element is always less than the vector's size. #include #include using namespace std; int main() { vector intVect; int value; int i; int n;
C++ Help
Integers are read from input and stored into a
Ex: If the input is 7 12 18 2 0, the vector's last element is 2. Thus, the output is:
18 2
Note: The input has at least three integers, and the vector's last element is always less than the vector's size.
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> intVect;
int value;
int i;
int n;
cin >> value;
while (value != 0) {
intVect.push_back(value);
cin >> value;
}
// insert code here
return 0;
}

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









