C++ essentialsFoundations
Variables & types
6 min lesson
C++ variables have types that define the values they can hold. Use const for values that should not change, and prefer clear, descriptive names.
Keep in mind
Modern C++ can often infer a local type with auto, but the type should still be obvious to a reader.
lesson.cpp
#include <iostream>
#include <string>
int main() {
const std::string learner = "Mina";
int lessons = 3;
std::cout << learner << " completed " << lessons << " lessons" << '\n';
}What happens: Mina completed 3 lessons