Advertisement
gmmmarcos

PILAS AVANZADO- ejercicio 1

Apr 4th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "pila.h"
  4.  
  5. int main()
  6. {
  7. char OP='s';
  8. int contador = 0;
  9. Pila DADA;
  10. inicpila (&DADA);
  11.  
  12.  
  13. while (OP=='s')
  14. {
  15. printf("INGRESE UN VALOR A LA PILA DADA\n");
  16. leer (&DADA);
  17. contador = contador + tope(&DADA);
  18. printf("\n DESEA INGRESAR OTRO? s/n\n");
  19. fflush(stdin);
  20. scanf("%c",&OP);
  21. }
  22.  
  23.  
  24.  
  25. printf("\n la suma de toda la pila: %i\n",contador);
  26. mostrar (&DADA);
  27.  
  28.  
  29. return 0;
  30. }
  31.  
  32. /* 1) Sumar los elementos de una pila (usar variables) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement