Standard Template Library (STL) Vectors & Maps

8 min read CPP 7 views

Mastering C++ STL (Standard Template Library)

The Standard Template Library (STL) provides powerful generic container classes and algorithms such as std::vector, std::map, std::set, and std::algorithm.

cpp Example
Run Code
#include <iostream>
#include <vector>
#include <map>

int main() {
    std::vector<int> numbers = {10, 20, 30};
    numbers.push_back(40);

    std::map<std::string, int> scores;
    scores["Alice"] = 95;
    scores["Bob"] = 88;

    for (const auto& [name, score] : scores) {
        std::cout << name << ": " << score << "\n";
    }
    return 0;
}

Related Tutorials