Creator prompt
The idea behind this presentation
┌─────────────────────────────────────────────────────────────────┐
│ 📦 ESTRUCTURAS (STRUCT / CLASS) │
│ │
│ DEFINICIÓN: │
│ Una estructura es un tipo de dato que agrupa variables │
│ de diferentes tipos bajo un mismo nombre. │
│ │
│ ¿POR QUÉ USAR ESTRUCTURAS? │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ SIN ESTRUCTURA: │ │
│ │ string nombre1 = "Ana"; │ │
│ │ int edad1 = 25; │ │
│ │ float altura1 = 1.65; │ │
│ │ │ │
│ │ string nombre2 = "Carlos"; │ │
│ │ int edad2 = 30; │ │
│ │ float altura2 = 1.75; │ │
│ │ │ │
│ │ CON ESTRUCTURA: │ │
│ │ struct Persona { │ │
│ │ string nombre; │ │
│ │ int edad; │ │
│ │ float altura; │ │
│ │ }; │ │
│ │ │ │
│ │ Persona p1 = {"Ana", 25, 1.65}; │ │
│ │ Persona p2 = {"Carlos", 30, 1.75}; │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ VENTAJAS: │
│ ✅ Agrupa datos relacionados │ │
│ ✅ Más organizado que variables separadas │ │
│ ✅ Fácil de pasar a funciones │ │
│ ✅ Permite arrays de estructuras │ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 📊 VECTORES (ARREGLOS UNIDIMENSIONALES) │
│ │
│ DEFINICIÓN: │
│ Un vector es una estructura de datos que almacena │
│ elementos del mismo tipo en posiciones contiguas de │
│ memoria, accesibles mediante un índice. │
│ │
│ ESTRUCTURA VISUAL: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ Índice: 0 1 2 3 4 │ │
│ │ ┌────┬────┬────┬────┬────┐ │ │
│ │ │ 10 │ 20 │ 30 │ 40 │ 50 │ │ │
│ │ └────┴────┴────┴────┴────┘ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ DECLARACIÓN: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ int numeros[5]; // Estático │ │
│ │ vector<int> nums(5); // Dinámico (STL) │ │
│ │ │ │
│ │ Python: │ │
│ │ numeros = [0] * 5 // Lista │ │
│ │ numeros = [] // Lista vacía │ │
│ │ import array; array.array('i', [0]*5) │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ OPERACIONES BÁSICAS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ ACCESO: vector[0] = 10; │ │
│ │ LECTURA: int x = vector[3]; │ │
│ │ RECORRIDO: for (int i = 0; i < n; i++) { ... } │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 📊 MATRICES (ARREGLOS BIDIMENSIONALES) │
│ │
│ DEFINICIÓN: │
│ Una matriz es un arreglo bidimensional que organiza los │
│ datos en filas y columnas. │
│ │
│ ESTRUCTURA VISUAL: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ Columna 0 Columna 1 Columna 2 │ │
│ │ ┌──────────┬──────────┬──────────┐ │ │
│ │ Fila 0 │ 1 │ 2 │ 3 │ │ │
│ │ ├──────────┼──────────┼──────────┤ │ │
│ │ Fila 1 │ 4 │ 5 │ 6 │ │ │
│ │ ├──────────┼──────────┼──────────┤ │ │
│ │ Fila 2 │ 7 │ 8 │ 9 │ │ │
│ │ └──────────┴──────────┴──────────┘ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ DECLARACIÓN: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ int matriz[3][4]; // Estática │ │
│ │ vector<vector<int>> m; // Dinámica (STL) │ │
│ │ │ │
│ │ Python: │ │
│ │ matriz = [[0]*4 for _ in range(3)] │ │
│ │ matriz = [[1,2,3], [4,5,6], [7,8,9]] │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ ACCESO: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: matriz[0][1] = 10; │ │
│ │ Python: matriz[0][1] = 10 │ │
│ │ Recorrido: for (i = 0; i < filas; i++) { │ │
│ │ for (j = 0; j < columnas; j++) { │ │
│ │ // procesar matriz[i][j] │ │
│ │ } │ │
│ │ } │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 📝 MANEJO DE CADENAS │
│ │
│ DEFINICIÓN: │
│ Una cadena (string) es una secuencia de caracteres │
│ utilizada para representar texto. │
│ │
│ REPRESENTACIÓN EN MEMORIA: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ "HOLA MUNDO" │ │
│ │ ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ │ │
│ │ │ H │ O │ L │ A │ │ M │ U │ N │ D │ O │ │ │
│ │ └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘ │ │
│ │ 0 1 2 3 4 5 6 7 8 9 │ │
│ │ │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ DECLARACIÓN: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ string s1 = "Hola"; │ │
│ │ string s2("Mundo"); │ │
│ │ char s3[] = "Texto"; │ │
│ │ │ │
│ │ Python: │ │
│ │ s1 = "Hola" │ │
│ │ s2 = 'Mundo' │ │
│ │ s3 = """Texto multilínea""" │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ OPERACIONES COMUNES: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ CONCATENACIÓN: "Hola" + "Mundo" → "HolaMundo" │ │
│ │ LONGITUD: len("Hola") → 4 │ │
│ │ ACCESO: "Hola"[1] → 'o' │ │
│ │ SUBSTRING: "HolaMundo"[1:5] → "olaM" │ │
│ │ BÚSQUEDA: "Hola".find("la") → 2 │ │
│ │ REEMPLAZO: "Hola".replace("o", "a") → "Hala"│ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ ➗ EXPRESIONES ARITMÉTICAS │
│ │
│ OPERADORES ARITMÉTICOS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ OPERADOR │ C++ │ PYTHON │ DESCRIPCIÓN │ │
│ ├────────────┼────────┼─────────┼───────────────────────┤ │
│ │ Suma │ + │ + │ a + b │ │
│ │ Resta │ - │ - │ a - b │ │
│ │ Multiplic.│ * │ * │ a * b │ │
│ │ División │ / │ / │ a / b │ │
│ │ Módulo │ % │ % │ a % b (residuo) │ │
│ │ Potencia │ pow() │ ** │ a ** b │ │
│ │ Incremento│ ++ │ += 1 │ a += 1 │ │
│ │ Decremento│ -- │ -= 1 │ a -= 1 │ │
│ └────────────┴────────┴─────────┴───────────────────────┘ │
│ │
│ PRECEDENCIA: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ 1. Paréntesis ( ) │ │
│ │ 2. Potencia (** en Python, pow() en C++) │ │
│ │ 3. Multiplicación, División, Módulo (*, /, %) │ │
│ │ 4. Suma y Resta (+, -) │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ EJEMPLOS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ 3 + 4 * 5 = 23 │ │
│ │ (3 + 4) * 5 = 35 │ │
│ │ 10 / 3 = 3 (C++ int), 3.333... (Python) │ │
│ │ 10 % 3 = 1 │ │
│ │ 2 ** 3 = 8 (Python), pow(2,3) = 8 (C++) │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 🔀 EXPRESIONES LÓGICAS │
│ │
│ OPERADORES DE COMPARACIÓN: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ OPERADOR │ C++ │ PYTHON │ DESCRIPCIÓN │ │
│ ├────────────┼────────┼─────────┼───────────────────────┤ │
│ │ Igual a │ == │ == │ a == b │ │
│ │ Diferente │ != │ != │ a != b │ │
│ │ Mayor que │ > │ > │ a > b │ │
│ │ Menor que │ < │ < │ a < b │ │
│ │ Mayor o = │ >= │ >= │ a >= b │ │
│ │ Menor o = │ <= │ <= │ a <= b │ │
│ └────────────┴────────┴─────────┴───────────────────────┘ │
│ │
│ OPERADORES LÓGICOS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ OPERADOR │ C++ │ PYTHON │ DESCRIPCIÓN │ │
│ ├────────────┼────────┼─────────┼───────────────────────┤ │
│ │ AND │ && │ and │ a && b │ │
│ │ OR │ || │ or │ a || b │ │
│ │ NOT │ ! │ not │ !a │ │
│ └────────────┴────────┴─────────┴───────────────────────┘ │
│ │
│ TABLAS DE VERDAD: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ AND: True AND True = True │ │
│ │ True AND False = False │ │
│ │ False AND True = False │ │
│ │ False AND False = False │ │
│ │ │ │
│ │ OR: True OR True = True │ │
│ │ True OR False = True │ │
│ │ False OR True = True │ │
│ │ False OR False = False │ │
│ │ │ │
│ │ NOT: NOT True = False │ │
│ │ NOT False = True │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 🔀 ESTRUCTURAS DE CONTROL - IF │
│ │
│ SINTÁXIS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ if (condición) { │ │
│ │ // Código si es verdadera │ │
│ │ } else if (otra_condición) { │ │
│ │ // Código si otra es verdadera │ │
│ │ } else { │ │
│ │ // Código si ninguna es verdadera │ │
│ │ } │ │
│ │ │ │
│ │ Python: │ │
│ │ if condicion: │ │
│ │ # Código si es verdadera │ │
│ │ elif otra_condicion: │ │
│ │ # Código si otra es verdadera │ │
│ │ else: │ │
│ │ # Código si ninguna es verdadera │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ EJEMPLO: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ int nota = 85; │ │
│ │ if (nota >= 90) { │ │
│ │ cout << "A"; │ │
│ │ } else if (nota >= 80) { │ │
│ │ cout << "B"; │ │
│ │ } else { │ │
│ │ cout << "C"; │ │
│ │ } │ │
│ │ │ │
│ │ Python: │ │
│ │ nota = 85 │ │
│ │ if nota >= 90: │ │
│ │ print("A") │ │
│ │ elif nota >= 80: │ │
│ │ print("B") │ │
│ │ else: │ │
│ │ print("C") │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 🔀 ESTRUCTURAS DE CONTROL - SWITCH / MATCH │
│ │
│ SINTÁXIS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++ (switch): │ │
│ │ switch (variable) { │ │
│ │ case valor1: │ │
│ │ // Código para valor1 │ │
│ │ break; │ │
│ │ case valor2: │ │
│ │ // Código para valor2 │ │
│ │ break; │ │
│ │ default: │ │
│ │ // Código por defecto │ │
│ │ } │ │
│ │ │ │
│ │ Python (match - Python 3.10+): │ │
│ │ match variable: │ │
│ │ case valor1: │ │
│ │ // Código para valor1 │ │
│ │ case valor2: │ │
│ │ // Código para valor2 │ │
│ │ case _: │ │
│ │ // Código por defecto │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ EJEMPLO: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ char op = '+'; │ │
│ │ switch (op) { │ │
│ │ case '+': cout << "Suma"; break; │ │
│ │ case '-': cout << "Resta"; break; │ │
│ │ default: cout << "Operación inválida"; │ │
│ │ } │ │
│ │ │ │
│ │ Python: │ │
│ │ op = '+' │ │
│ │ match op: │ │
│ │ case '+': print("Suma") │ │
│ │ case '-': print("Resta") │ │
│ │ case _: print("Operación inválida") │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 🔄 CICLOS - FOR │
│ │
│ SINTÁXIS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ for (inicialización; condición; incremento) { │ │
│ │ // Código a repetir │ │
│ │ } │ │
│ │ │ │
│ │ C++ (range-based): │ │
│ │ for (auto elemento : colección) { │ │
│ │ // Código a repetir │ │
│ │ } │ │
│ │ │ │
│ │ Python: │ │
│ │ for variable in range(inicio, fin, paso): │ │
│ │ # Código a repetir │ │
│ │ │ │
│ │ Python (iteración): │ │
│ │ for elemento in colección: │ │
│ │ # Código a repetir │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ EJEMPLOS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ for (int i = 0; i < 5; i++) { │ │
│ │ cout << i << " "; │ │
│ │ } // 0 1 2 3 4 │ │
│ │ │ │
│ │ Python: │ │
│ │ for i in range(5): │ │
│ │ print(i, end=" ") │ │
│ │ # 0 1 2 3 4 │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 🔄 CICLOS - FOR │
│ │
│ SINTÁXIS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ for (inicialización; condición; incremento) { │ │
│ │ // Código a repetir │ │
│ │ } │ │
│ │ │ │
│ │ C++ (range-based): │ │
│ │ for (auto elemento : colección) { │ │
│ │ // Código a repetir │ │
│ │ } │ │
│ │ │ │
│ │ Python: │ │
│ │ for variable in range(inicio, fin, paso): │ │
│ │ # Código a repetir │ │
│ │ │ │
│ │ Python (iteración): │ │
│ │ for elemento in colección: │ │
│ │ # Código a repetir │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ EJEMPLOS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ for (int i = 0; i < 5; i++) { │ │
│ │ cout << i << " "; │ │
│ │ } // 0 1 2 3 4 │ │
│ │ │ │
│ │ Python: │ │
│ │ for i in range(5): │ │
│ │ print(i, end=" ") │ │
│ │ # 0 1 2 3 4 │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
---
┌─────────────────────────────────────────────────────────────────┐
│ 🔄 CICLOS - WHILE │
│ │
│ SINTÁXIS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ while (condición) { │ │
│ │ // Código a repetir │ │
│ │ } │ │
│ │ │ │
│ │ do { │ │
│ │ // Código a repetir (al menos una vez) │ │
│ │ } while (condición); │ │
│ │ │ │
│ │ Python: │ │
│ │ while condicion: │ │
│ │ # Código a repetir │ │
│ │ │ │
│ │ # No hay do-while en Python │ │
│ │ # Se simula con while True + break │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ EJEMPLOS: │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ C++: │ │
│ │ int i = 0; │ │
│ │ while (i < 5) { │ │
│ │ cout << i << " "; │ │
│ │ i++; │ │
│ │ } // 0 1 2 3 4 │ │
│ │ │ │
│ │ Python: │ │
│ │ i = 0 │ │
│ │ while i < 5: │ │
│ │ print(i, end=" ") │ │
│ │ i += 1 │ │
│ │ # 0 1 2 3 4 │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Follow Design: {"palette":["Editor navy #0D1117 — primary canvas background","Subtle slate #161B22 — secondary panel background","Syntax cyan #58A6FF — C++ highlights and key structural headers","Python gold #F2C94C — Python highlights and comparison badges","Terminal mint #3FB950 — success badges and return values","Code base white #F0F6FC — primary body and code text"],"fonts":{"Space Grotesk":"https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap","Inter":"https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,100..900;1,100..900&display=swap","JetBrains Mono":"https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"},"type":"Space Grotesk bold (32pt) for high-impact concept titles with uppercase tracking (+0.05em); Inter regular (14pt/1.5) for concept explanations; JetBrains Mono regular and medium (13pt/1.4) for all code snippets, memory matrices, and syntax blocks.","layout":"Structured 2-column comparative layout with 48px margins and 24px column gutters. Slide header sits in top 15% with an inline topic icon; the remaining 85% splits evenly into parallel C++ and Python code execution cards.","framework_treatment":"Deep dark-mode IDE containers with subtle 1px slate borders (#30363D) and soft 8px corner radiuses. Array memory blocks are rendered as segmented linear grids with index callouts resting precisely above each cell.","feels_like":"A premium VS Code developer cheat sheet meets modern Stripe developer documentation"}