1 / 11

CLASE 4 - ALGORITMIA BASICA

CLASE 4 - ALGORITMIA BASICA. Pseudocódigo, diagramas de flujo, algo de C. PRIMEROS PASOS CON EL DFD. Ventana del DFD. PRIMEROS PASOS CON EL DFD. Pseudocódigo a implementar. Inicio numerico: a, b, c  0; escriba(‘Digite el primer numero’); lea a;

soleil
Download Presentation

CLASE 4 - ALGORITMIA BASICA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CLASE 4 - ALGORITMIA BASICA Pseudocódigo, diagramas de flujo, algo de C.

  2. PRIMEROS PASOS CON EL DFD • Ventana del DFD

  3. PRIMEROS PASOS CON EL DFD • Pseudocódigo a implementar Inicio numerico: a, b, c  0; escriba(‘Digite el primer numero’); lea a; escriba(‘Digite el segundo numero’); lea b; c  a + b; escriba (‘El resultado de la suma es’, c); Fin ??

  4. Salida de texto • En Pseudocódigo: escriba(‘cadena1’,…,’cadenaN’,var1,var2,…,varM); • En lenguaje C (Forma mas basica): printf(‘cadena de caracteres’, variable); • Diagrama de flujo. • Generalización.

  5. Entrada de texto • En Pseudocódigo: lea(‘cadena_de _caracteres a escribir’, var1,…, varN); • En lenguaje C (Forma mas basica): scanf(‘cadena_de_control’, var1,…, varN); • Diagrama de flujo. • Generalización.

  6. Asignacion • En Pseudocódigo: Involucra el uso de operadores aritmeticos, logicos: Por ejemplo: raiz  (-b-(b^2-4*a*c)^(1/2))/(2*a) • En lenguaje C (Forma mas basica): raiz = (-b-(b^2-4*a*c)^(1/2))/(2*a); • Diagrama de flujo. • Generalización. int main(){ // Coloque aquí su código … }

  7. Implementando el algoritmo completamente Inicio numerico: a, b, c  0; escriba(‘Digite el primer numero’); lea a; escriba(‘Digite el segundo numero’); lea b; c  a + b; escriba (‘El resultado de la suma es’, c); Fin #include<stdio.h> int main(){ int a, b, c = 0; printf(“Digite el primer numero: ”); scanf(“%d”,&a); printf(“Digite el segundo numero: ”); scanf(“%d”,&b); c = a + b; printf(“El resultado de la suma es: %d”,c); }

  8. Probando todo

  9. Ejecutando el programa Escriba Lea Despliegue del resultado: ???

  10. Ahora probado todo en C • Asumiendo que el programa recién editado se llama: miPrimerPrograma.c • Compilar: gcc programa.c –o nombreEjecutable • $ gcc miPrimerPrograma.c –o sumador • Ensamblar (Por si se desea ver el código de bajo nivel): gcc -S programa.c • $gcc -S miPrimerPrograma.c • Ejecutar: ./nombreEjecutable • $./sumador

  11. Para que profundicen • Pagina del programa DFD: • http://wiki.freaks-unidos.net/freedfd/ • http://microe.udea.edu.co/~henry/informatica1/clase_4/dfd.pdf • Tutorial en español (pa empezar) sobre el compilador gcc: • http://iie.fing.edu.uy/~vagonbar/gcc-make/gcc.htm • http://old.gpul.org/articulos/propios/compilacion.txt

More Related