C++ is a general-purpose programming language created as an extension of C. It supports object-oriented, generic, and functional programming. C++ is used for game development, system software, real-time applications, and high-performance computing.
C++
Beginner
8 min read
Introduction to C++
Example
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
// Basic output
cout << "Hello, C++!" << endl;
// Variables
int count = 10;
double price = 29.99;
string name = "Alice";
bool isAdmin = true;
// Vector (dynamic array)
vector<int> nums = {1, 2, 3, 4, 5};
nums.push_back(6);
for (int n : nums) { // range-based for loop
cout << n << " ";
}
cout << endl;
// Lambda (C++11)
auto square = [](int x) { return x * x; };
cout << "5 squared: " << square(5) << endl;
return 0;
}