Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

// C++ Cheat Sheet

// Variables and Data Types


int num = 42;
std::string str = "Hello, World!";
bool flag = true;

// Arrays and Vectors


int myArray[] = {1, 2, 3};
std::vector<int> myVector = {4, 5, 6};

// Control Flow
if (condition) {
// code block
} else if (anotherCondition) {
// code block
} else {
// code block
}

// Loops
for (int i = 0; i < 5; i++) {
// code block
}

// Functions
int myFunction(int param1, int param2) {
// code block
return result;
}

You might also like