using C++. Read integers from input and store each integer into a vector until 0 is read. Do not store 0 into the vector

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

using C++. Read integers from input and store each integer into a vector until 0 is read. Do not store 0 into the vector

Post by answerhappygod »

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;}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply