elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / nueva duda pila en C en: 18 Marzo 2011, 07:25 am
Esta es mi nueva duda ... al compilar me sale error en la funcion convertir cuando llamo a las funciones push y pop.

Código
  1. #include <iostream.h>
  2. int num=0,base=0,val=0,x=0;
  3. typedef struct datos{
  4.        int dato;
  5.        struct datos *siguiente;
  6.        }tipoNodo;
  7.  
  8. typedef tipoNodo *pNodo;
  9. typedef tipoNodo *Pila;
  10. typedef Pila *pila;
  11.  
  12. void push (Pila *l,int val);
  13. int pop (Pila *l);
  14.  
  15. void push(Pila *pila,int val){
  16.     pNodo nuevo;
  17.     nuevo = (pNodo) malloc (sizeof(tipoNodo));
  18.     nuevo->dato = val;
  19.     nuevo->siguiente =*pila;
  20.     *pila = nuevo;
  21.     }
  22.  
  23. int pop(Pila *pila){
  24.     pNodo aux;
  25.     int v;
  26.     aux = *pila;
  27.     if (!aux) cout<<"\npila vacia\n";
  28.     *pila = aux->siguiente;
  29.     v = aux->dato;
  30.     free (aux);
  31.     return v;
  32.     system ("pause");
  33.     }
  34.  
  35. void convertir(int num,int base){
  36.            int x=0,val=0,aux=0;
  37.                  aux=num;
  38.                  do{
  39.                  val=num%base;
  40.                  aux=aux/base;
  41.                  void push(&pila,val);
  42.                  cout<<"el elemento insertado es:"<<val;
  43.                  x=pop(&pila);
  44.                  cout<<x;
  45.                  system("pause");
  46.                  }while(aux>base);
  47.  
  48.            }    
  49.  
  50.  
  51.  
  52. int main (){
  53.     Pila pila = NULL;
  54.     cout << "Codigo binario de un numero\nDigita el numero\n";
  55.     cin>>num;
  56.     cout << "Digita la base que deseas\n";
  57.     cin >>base;
  58.     void convertir (int num,int base);
  59.  
  60. }
  61.  

Saludos
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines