├── EjemplosC++ ├── Tema02 │ ├── 02_01_hola_mundo.cpp │ ├── 02_02_constantes.cpp │ ├── 02_03_variables.cpp │ ├── 02_04_ambito.cpp │ ├── 02_05_entrada_salida.cpp │ └── 02_06_namespace.cpp ├── Tema03 │ ├── 03_01_precedencia.cpp │ ├── 03_02_operadores.cpp │ └── 03_03_conversion.cpp ├── Tema04 │ ├── 04_01_sentencia_if_simple.cpp │ ├── 04_02_sentencia_if_doble.cpp │ ├── 04_03_sentencia_if_doble_2.cpp │ ├── 04_04_sentencia_if_anidada.cpp │ ├── 04_05_sentencia_if_sentencias_complejas.cpp │ ├── 04_06_sentencia_switch.cpp │ ├── 04_07_sentencia_switch_menu.cpp │ ├── 04_08_bucle_while.cpp │ ├── 04_09_bucle_for.cpp │ ├── 04_10_bucle_for_2.cpp │ └── 04_11_bucle_do_while.cpp ├── Tema05 │ ├── 05_01_funciones_1.cpp │ ├── 05_02_funciones_2.cpp │ └── 05_03_funciones_3.cpp ├── Tema06 │ ├── 06_01_arrays_1.cpp │ └── 06_02_arrays_2.cpp ├── Tema07 │ ├── 07_01_estructuras.cpp │ └── 07_02_array_estructuras.cpp ├── Tema08 │ ├── 08_01_punteros.cpp │ ├── 08_02_paso_valor.cpp │ ├── 08_03_paso_referencia.cpp │ ├── 08_04_punteros_estructuras.cpp │ ├── 08_05_arrays_dinamicos.cpp │ ├── 08_06_arrays_bidimensionales_dinamicos.cpp │ └── 08_07_arrays_estructuras_dinamicos.cpp ├── Tema09 │ ├── 09_01_cadenas1.cpp │ └── 09_02_cadenas2.cpp ├── Tema10 │ └── 10_01_recursividad.cpp ├── Tema11 │ ├── 11_01_flujos.cpp │ ├── 11_02_flujos_2.cpp │ ├── 11_03_flujos_3.cpp │ ├── 11_04_flujos_4.cpp │ ├── 11_05_archivos.cpp │ ├── 11_06_archivos_2.cpp │ ├── 11_07_archivos_texto.cpp │ ├── 11_08_archivos_binario.cpp │ ├── 11_09_archivos_binario_2.cpp │ ├── fichero_binario.txt │ ├── fichero_texto.txt │ └── salida.txt ├── Tema12 │ ├── 12_01_listas.cpp │ ├── 12_02_pilas.cpp │ └── 12_03_colas.cpp └── info.txt ├── README.md ├── Tema01-Introduccion_programacion.pdf ├── Tema02-Elementos_basicos_C++.pdf ├── Tema03-Operadores_expresiones.pdf ├── Tema04-Estructuras_seleccion_y_control.pdf ├── Tema05-Funciones.pdf ├── Tema06-Vectores_matrices.pdf ├── Tema07-Estructuras.pdf ├── Tema08-Punteros_y_memoria_dinamica.pdf ├── Tema09-Manejo_cadenas.pdf ├── Tema10-Recursividad_ordenacion.pdf ├── Tema11-Flujos_archivos.pdf └── Tema12-Listas_pilas_colas.pdf /EjemplosC++/Tema02/02_01_hola_mundo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | cout << "Hola mundo en C++"; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /EjemplosC++/Tema02/02_02_constantes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define PI 3.141592 4 | 5 | using namespace std; 6 | 7 | int main () 8 | { 9 | const int numero = 4; 10 | enum Colores {Rojo, Naranja, Amarillo, Verde, Azul, Violeta}; 11 | 12 | cout << PI << endl; 13 | cout << numero << endl; 14 | cout << Rojo << endl; 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /EjemplosC++/Tema02/02_03_variables.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | int variable; 8 | int noInicializada; 9 | int numero = 4; 10 | float decimal = 1.7534; 11 | int variable1, variable2, variable3; 12 | 13 | variable = 4; 14 | cout << numero << endl; 15 | cout << decimal << endl; 16 | cout << variable << endl; 17 | cout << noInicializada << endl; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /EjemplosC++/Tema02/02_04_ambito.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int variableGlobal = 4; 6 | 7 | int main () 8 | { 9 | int variableLocal = 3; 10 | 11 | variableLocal = 2; 12 | cout << variableLocal << endl; 13 | 14 | variableGlobal = 3; 15 | cout << variableGlobal << endl; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /EjemplosC++/Tema02/02_05_entrada_salida.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema02/02_05_entrada_salida.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema02/02_06_namespace.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace geo 4 | { 5 | const double PI = 3.141592; 6 | double longitudCircunferencia (int radio) 7 | { 8 | return 2*PI*radio; 9 | } 10 | } 11 | 12 | using namespace std; 13 | using namespace geo; 14 | 15 | int main () 16 | { 17 | int radio; 18 | cout << "Introduce el radio de la circunferencia: "; 19 | cin >> radio; 20 | 21 | cout << "Longitud de la circunferencia: " << longitudCircunferencia(radio) << endl; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /EjemplosC++/Tema03/03_01_precedencia.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | cout << 6 + 3 * 4 / 2 + 2 << endl; // 14 8 | cout << (6 + 3) * 4 / (2 + 2) << endl; // 9 9 | cout << 6 + (3 * 4) / 2 + 2 << endl; // 14 10 | cout << 6 + (3 * 4) / (2 + 2) << endl; // 9 11 | } 12 | -------------------------------------------------------------------------------- /EjemplosC++/Tema03/03_02_operadores.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | int valor, saldo = 0, resultado, c1 = 5, c2 = 4, cantidad; 8 | int a = 17; 9 | int b = 14; 10 | valor = 5; 11 | saldo += 10; 12 | resultado = saldo - valor; 13 | cantidad *= c1 + c2; 14 | 15 | cout << resultado << endl; 16 | cout << ++cantidad << endl; 17 | cout << cantidad++ << endl; 18 | 19 | cout << (resultado >= cantidad) << endl; 20 | cout << (resultado != cantidad) << endl; 21 | cout << (resultado || cantidad) << endl; 22 | 23 | cout << ((1 < 10) && (resultado != cantidad)) << endl; 24 | cout << (! 1) << endl; 25 | 26 | cout << (a < b) ? a : b ; 27 | } 28 | -------------------------------------------------------------------------------- /EjemplosC++/Tema03/03_03_conversion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | int entero = 50; 8 | float flotante = entero; 9 | 10 | cout << entero << endl; 11 | cout << flotante << endl; 12 | 13 | flotante = 3.141592; 14 | entero = (int) flotante; 15 | 16 | cout << entero << endl; 17 | cout << flotante << endl; 18 | 19 | flotante = 3.141592; 20 | entero = flotante; 21 | 22 | cout << entero << endl; 23 | cout << flotante << endl; 24 | } 25 | -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_01_sentencia_if_simple.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_01_sentencia_if_simple.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_02_sentencia_if_doble.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_02_sentencia_if_doble.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_03_sentencia_if_doble_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_03_sentencia_if_doble_2.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_04_sentencia_if_anidada.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_04_sentencia_if_anidada.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_05_sentencia_if_sentencias_complejas.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_05_sentencia_if_sentencias_complejas.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_06_sentencia_switch.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_06_sentencia_switch.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_07_sentencia_switch_menu.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_07_sentencia_switch_menu.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_08_bucle_while.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | int numeros = 100; 8 | 9 | while (numeros > 0) 10 | { 11 | cout << numeros-- << endl; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_09_bucle_for.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | for (int i = 0; i <= 100; i++) 8 | { 9 | cout << i << endl; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_10_bucle_for_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema04/04_10_bucle_for_2.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema04/04_11_bucle_do_while.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | char caracter = 'a'; 8 | do 9 | { 10 | cout << caracter; 11 | caracter++; 12 | } while (caracter <= 'z'); 13 | } 14 | -------------------------------------------------------------------------------- /EjemplosC++/Tema05/05_01_funciones_1.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema05/05_01_funciones_1.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema05/05_02_funciones_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema05/05_02_funciones_2.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema05/05_03_funciones_3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema05/05_03_funciones_3.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema06/06_01_arrays_1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | char nombre[] = {'P', 'e', 'p', 'e', '\0'}; 8 | int numeros[6] = {0, 1, 2, 3, 4, 5}; 9 | int edades[4]; 10 | 11 | cout << nombre << endl; 12 | 13 | for (int i = 0; i < 6; i++) 14 | cout << numeros[i] << " "; 15 | 16 | cout << endl; 17 | 18 | cout << "Introduce 4 edades" << endl; 19 | 20 | for (int i = 0; i < 4; i++) 21 | { 22 | cout << "Edad " << (i + 1) << ": "; 23 | cin >> edades[i]; 24 | } 25 | 26 | cout << "Edades introducidas: "; 27 | for (int i = 0; i < 4; i++) 28 | cout << edades[i] << " "; 29 | } 30 | -------------------------------------------------------------------------------- /EjemplosC++/Tema06/06_02_arrays_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main () 6 | { 7 | int notas[2][5]; 8 | 9 | cout << "Introduce 10 notas" << endl; 10 | 11 | for (int i = 0; i < 2; i++) 12 | { 13 | for (int j = 0; j < 5; j++) 14 | { 15 | cout << "Nota : "; 16 | cin >> notas[i][j]; 17 | } 18 | } 19 | 20 | cout << "Notas introducidas: "; 21 | 22 | for (int i = 0; i < 2; i++) 23 | { 24 | for (int j = 0; j < 5; j++) 25 | { 26 | cout << notas[i][j] << " "; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /EjemplosC++/Tema07/07_01_estructuras.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct Persona 5 | { 6 | char nombre[30]; 7 | int id; 8 | float nota; 9 | }; 10 | 11 | using namespace std; 12 | 13 | int main () 14 | { 15 | Persona pepito; 16 | Persona * ptr = &pepito; 17 | 18 | cout << "Nombre del estudiante: "; 19 | gets(pepito.nombre); 20 | 21 | cout << "Id. del estudiante: "; 22 | cin >> pepito.id; 23 | 24 | cout << "Nota del estudiante: "; 25 | cin >> pepito.nota; 26 | 27 | cout << "Datos introducidos: " << endl; 28 | cout << "====================" << endl; 29 | cout << pepito.nombre << endl; 30 | cout << pepito.id << endl; 31 | cout << pepito.nota << endl; 32 | } 33 | -------------------------------------------------------------------------------- /EjemplosC++/Tema07/07_02_array_estructuras.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct Persona 4 | { 5 | char nombre[30]; 6 | int id; 7 | float nota; 8 | }; 9 | 10 | using namespace std; 11 | 12 | int main () 13 | { 14 | Persona personas[3]; 15 | 16 | cout << "Introduce los datos de los estudiantes" << endl; 17 | for (int i = 0; i < 3; i++) 18 | { 19 | cout << "Registro " << i << endl; 20 | cout << "Nombre del estudiante: "; 21 | cin >> personas[i].nombre; 22 | 23 | cout << "Id. del estudiante: "; 24 | cin >> personas[i].id; 25 | 26 | cout << "Nota del estudiante: "; 27 | cin >> personas[i].nota; 28 | cout << endl; 29 | } 30 | 31 | cout << endl; 32 | 33 | cout << "Datos introducidos: " << endl; 34 | cout << "====================" << endl; 35 | 36 | for (int i = 0; i < 3; i++) 37 | { 38 | cout << "Registro " << i << endl; 39 | cout << personas[i].nombre << endl; 40 | cout << personas[i].id << endl; 41 | cout << personas[i].nota << endl; 42 | cout << endl; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_01_punteros.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema08/08_01_punteros.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_02_paso_valor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema08/08_02_paso_valor.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_03_paso_referencia.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema08/08_03_paso_referencia.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_04_punteros_estructuras.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct Persona 5 | { 6 | char nombre[30]; 7 | int id; 8 | float nota; 9 | }; 10 | 11 | using namespace std; 12 | 13 | int main () 14 | { 15 | Persona pepito; 16 | Persona * ptr = &pepito; 17 | 18 | cout << "Nombre del estudiante: "; 19 | gets(pepito.nombre); 20 | 21 | cout << "Id. del estudiante: "; 22 | cin >> pepito.id; 23 | 24 | cout << "Nota del estudiante: "; 25 | cin >> pepito.nota; 26 | 27 | cout << "Datos introducidos: " << endl; 28 | cout << "====================" << endl; 29 | cout << ptr->nombre << endl; 30 | cout << ptr->id << endl; 31 | cout << ptr->nota << endl; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_05_arrays_dinamicos.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema08/08_05_arrays_dinamicos.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_06_arrays_bidimensionales_dinamicos.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema08/08_06_arrays_bidimensionales_dinamicos.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema08/08_07_arrays_estructuras_dinamicos.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema08/08_07_arrays_estructuras_dinamicos.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema09/09_01_cadenas1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | char frase1[] = "Copiando cadena"; 9 | char frase2[80]; 10 | strcpy(frase2,frase1); 11 | cout << "Cadena # 1: " << frase1 << endl; 12 | cout << "Cadena # 2: " << frase2 << endl; 13 | } 14 | -------------------------------------------------------------------------------- /EjemplosC++/Tema09/09_02_cadenas2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema09/09_02_cadenas2.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema10/10_01_recursividad.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema10/10_01_recursividad.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_01_flujos.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | char cadena[50]; 8 | cin.get(cadena, 8); 9 | cout << "[" << cadena << "]\n"; 10 | cin.get(cadena, sizeof(cadena)); 11 | cout << "[" << cadena << "]\n"; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_02_flujos_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | char nombre[50]; 8 | cin.getline(nombre, 50); 9 | cout << "Nombre: " << nombre; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_03_flujos_3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema11/11_03_flujos_3.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_04_flujos_4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema11/11_04_flujos_4.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_05_archivos.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | // Puedes salir del programa pulsando CTRL+C 9 | ofstream salida ("salida.txt"); 10 | 11 | if (!salida) 12 | { 13 | cout << "No se puede abrir el fichero para escribir" << endl; 14 | return -1; 15 | } 16 | 17 | char caracter; 18 | while (cin.get(caracter)) 19 | salida.put(caracter); 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_06_archivos_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | // Prueba a indicar el fichero salida.txt 9 | cout << "Indica el nombre del fichero: "; 10 | 11 | char nombreArchivo[80]; 12 | cin >> nombreArchivo; 13 | 14 | ifstream archivo (nombreArchivo); 15 | 16 | if (!archivo) 17 | { 18 | cout << "No se puede abrir el fichero para leer" << endl; 19 | return -1; 20 | } 21 | 22 | char caracter; 23 | while (archivo.get(caracter)) 24 | cout.put(caracter); 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_07_archivos_texto.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema11/11_07_archivos_texto.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_08_archivos_binario.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | ofstream salida("fichero_binario.txt", ios::out | ios::binary); 9 | if (!salida) 10 | { 11 | cout << "No se puede abrir el fichero" << endl; 12 | return -1; 13 | } 14 | 15 | int car; 16 | while ((car = cin.get()) != EOF) 17 | salida.put(car); 18 | 19 | salida.close(); 20 | } 21 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/11_09_archivos_binario_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | ifstream entrada("fichero_binario.txt", ios::in | ios::binary); 9 | char c; 10 | if (!entrada) 11 | { 12 | cout << "No se puede abrir el fichero" << endl; 13 | return -1; 14 | } 15 | 16 | while(entrada) 17 | { 18 | entrada.get(c); 19 | cout << c; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/fichero_binario.txt: -------------------------------------------------------------------------------- 1 | 1 2 | hoasl 3 | asdf 4 | asdf 5 | asd 6 | fasd 7 | f 8 | asdf 9 | asd 10 | fasd 11 | f 12 | asdf 13 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/fichero_texto.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 3.1415 3 | Cadena de caracteres 4 | -------------------------------------------------------------------------------- /EjemplosC++/Tema11/salida.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 2 4 | 2 5 | 2 6 | 23 7 | 4 8 | 234 9 | 23 10 | 423 11 | -------------------------------------------------------------------------------- /EjemplosC++/Tema12/12_01_listas.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema12/12_01_listas.cpp -------------------------------------------------------------------------------- /EjemplosC++/Tema12/12_02_pilas.cpp: -------------------------------------------------------------------------------- 1 | //paso por valor y referencia 2 | 3 | #include 4 | 5 | using namespace std; 6 | 7 | struct estructurapila 8 | { 9 | int dato; 10 | estructurapila *siguiente; 11 | }; 12 | 13 | int anadir(estructurapila **, int numero); 14 | int sacar(estructurapila **, int *); 15 | int vacia(estructurapila *); 16 | void recorrer(estructurapila *); 17 | void recorrerinverso(estructurapila *); 18 | void recorrerrecursivo(estructurapila *); 19 | int contarpila(estructurapila *); 20 | 21 | int main() 22 | { 23 | estructurapila *pila = NULL; 24 | int numero=0, lectura=0, contador=0; 25 | int valorcontado=0; 26 | int dato2=0; 27 | //cout<<"Direccion almacenada en pila:"<>lectura; 38 | switch(lectura) 39 | { 40 | case 1: cout<<"Introduce el dato:";cin>>numero;anadir(&pila, numero);break; 41 | case 2: sacar(&pila, &numero);cout<siguiente; 67 | } 68 | 69 | } 70 | return contador; 71 | } 72 | void recorrerrecursivo(estructurapila *nodopilarecorrer) 73 | { 74 | if( vacia(nodopilarecorrer)==1) cout<<"Fin"<dato<siguiente); 79 | } 80 | } 81 | void recorrer(estructurapila *nodopilarecorrer2) 82 | { 83 | if (vacia(nodopilarecorrer2)==1) cout<<"Pila Vacia"<dato<siguiente; 89 | } 90 | } 91 | 92 | 93 | 94 | void recorrerinverso(estructurapila *nodopilarecorrerinverso) 95 | { 96 | if( vacia(nodopilarecorrerinverso)==1) cout<<"Inicio recorrido:"<siguiente); 101 | cout<dato<dato = numero; 109 | nuevapila->siguiente = *nodopila; 110 | *nodopila = nuevapila; 111 | } 112 | 113 | 114 | int sacar(estructurapila **nodopilasalida, int *numerosalida) 115 | { 116 | if(vacia(*nodopilasalida)==1) cout<dato; 122 | *nodopilasalida= aux->siguiente; 123 | delete aux; 124 | } 125 | } 126 | 127 | int vacia(estructurapila *nodopilavacia) 128 | { 129 | if(nodopilavacia==NULL) 130 | return 1; 131 | else 132 | return 0; 133 | 134 | } 135 | 136 | -------------------------------------------------------------------------------- /EjemplosC++/Tema12/12_03_colas.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/EjemplosC++/Tema12/12_03_colas.cpp -------------------------------------------------------------------------------- /EjemplosC++/info.txt: -------------------------------------------------------------------------------- 1 | Esta carpeta contiene los ejemplos de cada uno de los ficheros pdf de teoría -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # temario-cpp-programacion 2 | Temario de la parte de C++ del módulo de Programación, de 1º de CFGS de Desarrollo de Aplicaciones Multiplataforma (DAM) 3 | -------------------------------------------------------------------------------- /Tema01-Introduccion_programacion.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema01-Introduccion_programacion.pdf -------------------------------------------------------------------------------- /Tema02-Elementos_basicos_C++.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema02-Elementos_basicos_C++.pdf -------------------------------------------------------------------------------- /Tema03-Operadores_expresiones.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema03-Operadores_expresiones.pdf -------------------------------------------------------------------------------- /Tema04-Estructuras_seleccion_y_control.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema04-Estructuras_seleccion_y_control.pdf -------------------------------------------------------------------------------- /Tema05-Funciones.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema05-Funciones.pdf -------------------------------------------------------------------------------- /Tema06-Vectores_matrices.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema06-Vectores_matrices.pdf -------------------------------------------------------------------------------- /Tema07-Estructuras.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema07-Estructuras.pdf -------------------------------------------------------------------------------- /Tema08-Punteros_y_memoria_dinamica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema08-Punteros_y_memoria_dinamica.pdf -------------------------------------------------------------------------------- /Tema09-Manejo_cadenas.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema09-Manejo_cadenas.pdf -------------------------------------------------------------------------------- /Tema10-Recursividad_ordenacion.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema10-Recursividad_ordenacion.pdf -------------------------------------------------------------------------------- /Tema11-Flujos_archivos.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema11-Flujos_archivos.pdf -------------------------------------------------------------------------------- /Tema12-Listas_pilas_colas.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldmoral1987/temario-programacion-cpp-dam/7f4e2aea452151d1f2dc0497f3366e16f8838f66/Tema12-Listas_pilas_colas.pdf --------------------------------------------------------------------------------