Lesson 10
STL and Modern C++ Basics
Modern C++ includes powerful library tools such as the Standard Template Library. A great place to start is vector and the range-based for loop.
vector Example
Example
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> numbers = {1, 2, 3, 4, 5};
for (int n : numbers)
{
cout << n << " ";
}
return 0;
}auto Example
Example
#include <iostream>
using namespace std;
int main()
{
auto x = 10;
auto y = 3.14;
cout << x << endl;
cout << y << endl;
return 0;
}Try it yourself:
You have completed the short 10-lesson tutorial. Continue with the full book to learn OOP, STL, debugging, Visual Studio workflow, CMake, and a complete final project.
Book Tip:
This short lesson is part of a larger learning path. The full book expands each topic with more explanation, exercises, and projects.