Mastery 23 – Creation and use of lists in Python Here’s WSQ10 in which I created and used a list. Mastery 25 – Creation and use of ranges in Python Here’s WSQ 14 in which is created and used a range in a for loop. You can algo assign it to a variable and use […]
Creation and use of vectors in C++
Creation and use of arrays in C++
This is #Mastery23 about creating and using vectors in C++. A vector in c++, is used to store different values in different storage compartments. It works almost the same as an array, the only difference is that the storage space can change. This is one of the differences with the arrays that storage spaces have to be declared.
Vectors take more memory space than arrays do. It is a list of values in which each of them are identified with a number. They can be made by any element and type.
These is how you declare a vector.
– You declare de type inside the angle brackets.
– You can declare the size of your vector in between parenthesis ( 6).
–
Vectors can be represented in the same way as arrays, like in a table.
– The count of vectors starts in 0.
Now you have located your values inside vectors, how can you access them? It is using the [ ]. You can give some space a value like this:
count[4]= 60;
The best part of using them is that its size can be modified.
– The copy constructor takes one vector and copies it in the same size.
– You can involve functions with a vector, like size( ). This function gives the size of a vector.
Vectors can also be used to create random numbers. Computers are designed to always return back any result with the same process, this is a problem when you are looking for the computer to show up a random number. C++ has a function called random that does all this process for you.
It is important to learn how to make use of the different facilities c++ have for you. You just need to be very careful when using them.
96
Normal
0
21
false
false
false
ES-TRAD
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
WATCH MY VIDEO https://youtu.be/XRxkoby_RUE
Here are masteries 23 and 25, about strings and vectors. Maybe the most complicated for me since I just learned how to use vectors. Enjoy: https://www.youtube.com/watch?v=llPuSsueAfY
Creation and use of vectors in C++
Creation and use of arrays in C++
Creation and use of strings in C++
Long video though, i accidently cut the video and had to edit it since i added more code, sorry if it seems slow.
Hey there! Here is my video for #Mastery23 and #Mastery24:
Vectors and stuff. Here is the usual definition of vectors, provided by our friends of Cplusplus.com: “Vectors are sequence containers representing arrays that can change in size. Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, […]