std::cout
Writes text and values to the console.
std::cout << "Score: " << score << std::endl;Short entries with an example for each. When you need every detail, each entry links to the official documentation.
Writes text and values to the console.
std::cout << "Score: " << score << std::endl;Every variable has a type: int, double, bool, std::string and more.
int age = 12;
double price = 4.99;
bool ready = true;
std::string name = "Ada";Runs code when a condition is true, and other code when it isn't.
if (marks >= 40) {
std::cout << "Pass";
} else {
std::cout << "Try again";
}Repeats a block a set number of times.
for (int i = 0; i < 3; i++) {
std::cout << i;
}Named, reusable code with a return type and parameters. Define them above main.
int square(int n) {
return n * n;
}A list that can grow. push_back adds; size counts.
std::vector<int> v = {1, 2};
v.push_back(3);
std::cout << v.size();A blueprint that bundles data and methods. Ends with };
class Dog {
public:
std::string name;
void bark() { std::cout << "Woof"; }
};Reads input typed by the user.
int age;
std::cin >> age;No entries match. Try a shorter word.