πΊοΈ The Standard Template Library (STL)
The C++ STL provides powerful, production-grade template data structures and algorithms.
π¦ Key STL Containers Overview
π» Code Example: Key-Value Hash Map & Vector Operations
βC++ Source Code (main.cpp)
#include <iostream>
#include <unordered_map>
#include <string>
int main() {
std::unordered_map<std::string, double> productPrices;
productPrices["Intel Core i9"] = 589.99;
productPrices["NVIDIA RTX 4090"] = 1599.99;
productPrices["DDR5 32GB RAM"] = 129.99;
std::cout << "--- PC Component Prices (Hash Table Lookup) ---" << std::endl;
for (const auto &[item, price] : productPrices) {
std::cout << "π¦ " << item << " => $" << price << std::endl;
}
return 0;
}
βWindows 11 Pro Terminal Execution OutputWindows 11 Pro Verified
βAdministrator: Windows 11 Pro Command Prompt (g++ GCC 13.2.0)
ββ‘β
Microsoft Windows [Version 10.0.22631.3007] (Windows 11 Pro x86_64)
(c) Microsoft Corporation. All rights reserved.
C:\Users\Student\CPP_Project>#include <iostream>
C:\Users\Student\CPP_Project> g++ -o main.exe main.cpp
C:\Users\Student\CPP_Project> main.exe
Hello World from C++ on Windows 11 Pro!
[Process exited with code 0 in 0.001 seconds]