C++ complete
C++ complete
📌 1. Introduction to C++
🔤 2. Basic Syntax
cpp
CopyEdit
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!";
return 0;
}
🔠 3. Data Types
➕ 4. Operators
Arithmetic: +, -, *, /, %
Relational: ==, !=, <, >, <=, >=
Logical: &&, ||, !
Assignment: =, +=, -=, etc.
Unary: ++, --
Bitwise: &, |, ^, ~, <<, >>
🔁 5. Control Structures
If-else
Switch-case
Loops:
o for
o while
o do-while
Break, continue, goto
🧠 6. Functions
cpp
CopyEdit
int add(int a, int b) {
return a + b;
}
📌 8. Pointers
cpp
CopyEdit
int a = 10;
int *p = &a;
cpp
CopyEdit
class Car {
public:
string brand;
void drive() { cout << "Driving"; }
};
cpp
CopyEdit
class Dog : public Animal { };
cpp
CopyEdit
Car() { }
~Car() { }
Single
Multilevel
Multiple
Hierarchical
Hybrid
ofstream fout("file.txt");
fout << "Hello!";
fout.close();
ifstream fin("file.txt");
string data;
fin >> data;
fin.close();
🧠 13. Templates
cpp
CopyEdit
template <class T>
T add(T a, T b) {
return a + b;
}
autokeyword
Range-based for
nullptr
Move semantics (std::move)
Lambda functions
Smart pointers
Structured bindings (C++17)
Modules (C++20)
Concepts (C++20)
4o