Question: In C++ Six integers are read from input as variables student1 to student6. Declare a vector of integers named studentListings and initialize the elements at

In C++

Six integers are read from input as variables student1 to student6. Declare a vector of integers named studentListings and initialize the elements at the even indices with the value 0 and the odd indices with the variables student1 to student6 in the order the input integers are read.

Ex: If the input is 29 19 24 18 3 9, then the output is:

0 29 0 19 0 24 0 18 0 3 0 9 

Note: Index 0 is considered an even index.

#include #include using namespace std;

int main() { int student1; int student2; int student3; int student4; int student5; int student6; unsigned int i;

cin >> student1; cin >> student2; cin >> student3; cin >> student4; cin >> student5; cin >> student6; /* Your code goes here */ for (i = 0; i < studentListings.size(); ++i) { cout << studentListings.at(i) << " "; } cout << endl; return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!