Advertisement
KingDothraki

Ej. 10

Apr 20th, 2020
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include<stdio.h>
  2. #include"math.h"
  3. #include"pila.h"
  4. void CargaPila (Pila *dada);
  5. double retorna (Pila);
  6. void main()
  7. {
  8.     Pila dada;
  9.     double numero;
  10.     inicpila(&dada);
  11.     CargaPila(&dada);
  12.     numero=retorna(dada);
  13.     printf("El numero formado es : %g\n",numero);//Control
  14. }
  15. void CargaPila(Pila *dada)
  16. {
  17.     char ctrl='s';
  18.     while (ctrl=='s')
  19.     {
  20.         leer(*&dada);
  21.         printf("Si desea continuar ingresando numeros presiones 's'\n");
  22.         fflush(stdin);
  23.         scanf("%c",&ctrl);
  24.     }
  25. }
  26. double retorna(Pila dada)
  27. {
  28.     int p=0;
  29.     double res=0;
  30.     Pila aux;
  31.     inicpila(&aux);
  32.     while(!pilavacia(&dada))
  33.     {
  34.         res+=desapilar(&dada)*pow(10,p);
  35.         p++;
  36.     }
  37.     return res;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement