Question: Write a C++ program as follows: Declare 2 empty vectors of integers named vector1 and vector 2, respectively. Add 10 and 20 to vector1 dynamically

Write a C++ program as follows:

Declare 2 empty vectors of integers named vector1 and vector 2, respectively.

Add 10 and 20 to vector1 dynamically using push_back

Display the elements in vector1 using the at() method as well as its size using the size() method

Add 100 and 200 to vector2 dynamically using push_back

Display the elements in vector2 using the at() method as well as its size using the size() method

Declare an empty 2D vector called vector_2d Remember, that a 2D vector is a vector of vector

Add vector1 to vector_2d dynamically using push_back

Add vector2 to vector_2d dynamically using push_back

Display the elements in vector_2d using the at() method

Change vector1.at(0) to 1000

Display the elements in vector_2d again using the at() method

Display the elements in vector1

please add notes on what each portion of code is doing

please constrain your coding method to introductory c++ material

Help....

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!