This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Libreria de manejo de entrada y salida. | |
*/ | |
#include <stdio.h> | |
/* | |
* Esta libreria nos permite solicitar pedazos de memoria al sistema operativo, que nos devolvera un la | |
* direcion de memoria en donde empieza el bloque. | |
*/ | |
#include <malloc.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> // este include nos permite el manejo basico de la entrada/salida | |
/* | |
* Para este ejemplo vamos a usar la estructura struct elemento como elemento de la pila, podemos implementar al pila con | |
* elementos de tipo entero, float, double, etc. | |
*/ | |
struct elemento{ | |
int x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* Hacemos la declaración del prototipo de la funcion */ | |
int mcm(int, int); | |
int main(){ | |
/* Declaremos variables */ | |
int primero, segundo; | |
int resultado; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
/* | |
* Para usar un archivo tenemos que asociar una variable puntero | |
* al archivo para poder escribir o leer de el | |
*/ | |
FILE *manejador_archivo = NULL; | |
/* | |
* Ahora que tenemos la variable para asignarla al archivo procedemos a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
double factorial(int); | |
int main(){ | |
int numero = 5; | |
double total; | |
total = factorial(numero); | |
printf("El factorial de %d es %d\n", numero, total); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.- Escriba un algoritmo que imprima las tablas de multiplicar del 2 y del 3. | |
Inicio | |
contador = 0 | |
multiplicacion = 0 | |
Para contador = 1 hasta 9 hacer | |
multiplicacion = 2 x contador | |
Imprimir " 2 x " contador " = " multiplicacion | |
Fin | |
Para contador = 1 hasta 9 hacer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.- Escriba un algoritmo que pregunte tu nombre y te de los buenos dias. | |
Inicio | |
nombre = "" | |
Imprimir "Dime como te llamas: " | |
leer nombre | |
Imprimir "Hola " nombre " buenos dias!!!" | |
Fin | |
2.- Escriba el algoritmo para calcular el volumen de un paralelepipedo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "colas.h" // Aca esta la implementacion de colas que es general para todo lo que use cola | |
struct nodo { | |
int turno; | |
struct nodo *sig; | |
} | |
struct cola { | |
struct nodo *punta; | |
struct nodo *fin; | |
int cont; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "animal.h" | |
Animal::Animal() { | |
this->setPatas(0); | |
} | |
void Animal::setPatas(int patas) { | |
// Los animales pueden tener 0 patas pero no un | |
// numero negativo de estas. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ANIMAL_H_ | |
#define _ANIMAL_H_ | |
class Animal | |
{ | |
public: | |
Animal(); | |
int getPatas(); | |
void setPatas(int); | |
protected: |
NewerOlder