




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





int age = 17; double price = 12.50; char grade = 'A'; bool passed = true;
age = 17 price = 12. grade = "A" passed = True
#include using namespace std;
int main() { int age; cin >> age; cout << "Age: " << age; return 0; }
age = int(input("Age: ")) print("Age:", age)
4. Operators
5. Conditional Statements
if (score >= 50) { cout << "Pass"; } else { cout << "Try again"; }
if score >= 50: print("Pass") else: print("Try again")
6. Loops
10. C++ Basics
#include
int main() { std::cout << "Hello, world!\n"; return 0; }
11. Arrays
int numbers[5] = {10, 20, 30, 40, 50}; cout << numbers[0]; // 10
12. Strings
#include std::string name = "Alex"; std::cout << name.length();
13. Pointers
int x = 10; int* p = &x;
std::cout << *p; // 10
14. References in C++
void addOne(int& x) { x++; }
15. Classes & Objects
class Student { public: std::string name;
void introduce() { std::cout << "Hi, I'm " << name; } };
Student s; s.name = "Alex"; s.introduce();
16. C++ STL Essentials
#include #include
std::vector a = {4, 1, 3, 2}; std::sort(a.begin(), a.end());
PART III — PYTHON
17. Python Syntax
name = "Destiny" if name: print("Hello,", name)
18. Lists, Tuples, Sets & Dictionaries
24. Time Complexity Basics
25. Quick Comparison
26. Mini Practice
Answer Key
27. Final Cheat Sheet