using C++. Read integers from input and store each integer intoa vector until 0 is read. Do not store 0 into the vector. Then, ifthe vector's last element is a multiple of 3, output the elementsin the vector at indices that are multiples of 3. Otherwise, outputthe elements in the vector at indices that are not multiples of 3.End each number with a newline.
Ex: If the input is 23 22 18 19 15 0, the vector's last elementis 15. Thus, the output is:
Note:
Here is the template of the problem, please use it:
#include <iostream>#include <vector>using namespace std;
int main() {
/* Your code goes here */
return 0;}
using C++. Read integers from input and store each integer into a vector until 0 is read. Do not store 0 into the vector
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am