C++ Dynamic Arrays : STL Vectors Beginner Tutorial

preview_player
Показать описание
In this C++ beginner tutorial I show you how to use STL vectors, which are dynamic arrays in C++. In a Visual Studio Console project I create a vector (namespace is std), use a range-based for loop to iterate the items, push_back (add) items, sort the vector and erase items.

In the previous part I explained fixed size STL arrays, now I show you the dynamic arrays.

See my social profiles here:

Рекомендации по теме
Комментарии
Автор

Port to TypeScript and Node.js. 2:00 - printing elements:
*Code:*
console.log("TypeScript: Array");

// Create a vector
const vec = [100, 10, 50];
// or:
// const vec = new Array<number>(100, 10, 50);

// Add new items to the vector
vec.push(67);

// Iterate the items and print them to the console
for (const number of vec) {
console.log("Number:", number);
}

ivan.enzhaev
Автор

Plz make a playlist of all c++ videos they are mixed with other videos .

pruthirajswain
Автор

2:00 - printing elements:
*Code:*
<html>

<body>
<script>
console.log("JavaScript: Array");

// Create a vector
const vec = [100, 10, 50];

// Add new items to the vector
vec.push(67);

// Iterate the items and print them to the console
for (const number of vec)
{
console.log("Number:", number);
}
</script>
</body>

</html>

ivan.enzhaev
Автор

I study Python and I rewrote this code 2:00 to Python:

print("Python: Standard list")

# Create a vector
vec = [100, 10, 50]

# Add new items to the vector
vec.append(67)

# Sort the items in the vector

# Iterate the items and print to the console
for number in vec:
print("Number:",  number)

ivan.enzhaev
visit shbcf.ru