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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started