Well this mastery I did it with mixed with two other masteries, but I dont have the points, so ….I changed it a little bit, and here it goes….

Also I leave here additional information about vector:

Vector is a template class that is a perfect replacement for the good old C-style arrays. It allows the same natural syntax that is used with plain arrays but offers a series of services that free the C++ programmer from taking care of the allocated memory and help operating consistently on the contained objects.

The first step using vector is to include the appropriate header:

#include <vector>

Note that the header file name does not have any extension; this is true for all of the Standard Library header files. The second thing to know is that all of the Standard Library lives in the namespace std. This means that you have to resolve the names by prepending std:: to them:

std::vector<int> v; // declares a vector of integers

#mastery23

 

CC BY 4.0 MASTERY 23 by boshe189 is licensed under a Creative Commons Attribution 4.0 International License.