Ver Mensaje Individual
  #10 (permalink)  
Antiguo 21/10/2010, 19:32
vnvnation
 
Fecha de Ingreso: marzo-2009
Mensajes: 74
Antigüedad: 15 años, 1 mes
Puntos: 1
Respuesta: Error conversion from `TipoPila**' to non-scalar type `TipoPila' requested

Entonces quedaria a si o me equivoco¿? si no avansare a crear mi siguiente funcion de contar e imprimir cuantos elementos tiene mi pila

Código C++:
Ver original
  1. #include <iostream.h>
  2. #include <conio.h>
  3. #define MAX 3
  4. #define VACIO -1
  5. typedef int TipoTope;
  6. typedef char TipoElem;
  7. typedef struct TipoPila{
  8.          TipoTope Tope ;
  9.           TipoElem Elementos [MAX];
  10.           };
  11.  
  12. int InicializarPila (TipoPila *Stack);
  13. int PilaLlena (TipoPila *Stack);
  14. int Push (TipoPila *Stack, TipoTope valor);
  15. int Pop(TipoPila *Stack);
  16.   main ()
  17. {
  18. TipoPila Pila;
  19. TipoElem valor;
  20. int   opcion1=0;
  21. //InicializarPila(&Pila);
  22. //Push (&Pila,valor);
  23.  
  24. while (opcion1!='s')
  25. {
  26. cout << "\n\nSELECCIONE UNA OPCION DE LAS SIGUIENTES:";
  27.  cout <<"\n1 Inicializar Pila";
  28.  cout <<"\n2 Ingresar datos a la Pila";
  29.  cout <<"\n3 Sacar datos de la pila\nOpcion=";
  30.   cin >> opcion1;
  31.  
  32. switch (opcion1){
  33.        case 1:
  34.             InicializarPila(&Pila);
  35.        cout<<"Pila inicializada ...";
  36.        system ("pause");
  37.        break;
  38.        case 2:
  39.        Push(&Pila,valor);
  40.        break;
  41.        case 3:
  42.        Pop(&Pila);
  43.        system ("pause");
  44.        break;
  45.  
  46.           }
  47.    system ("cls");      
  48. }}
  49.  
  50. int InicializarPila(TipoPila *Stack)
  51. {
  52.      Stack->Tope=VACIO;
  53.      }
  54.  
  55. int Push(TipoPila *Stack, TipoTope valor)
  56.  
  57. {   TipoElem Elementos;
  58.  if(Stack->Tope==MAX)
  59.           cout << "\nPila llena!!!!\n";
  60.  else
  61.  {
  62.      cout<<"Ingrese elementos a la pila:";
  63.      cin >> Elementos;
  64.         Stack->Tope++;
  65.         Stack->Elementos[Stack->Tope] = valor;
  66.  }
  67. }
  68.  
  69.  
  70. int Pop(TipoPila *Stack)
  71. {  
  72.  if(Stack->Tope==VACIO)
  73.           cout << "\nPila esta vacia ingrese datos primero:\n";
  74.  else
  75.  {
  76.         Stack->Tope--;
  77.        }
  78. }