Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 2, 2019 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/cf2e5ccc903eebb5c4211cfdc3a7dbaf to your computer and use it in GitHub Desktop.
Save parzibyte/cf2e5ccc903eebb5c4211cfdc3a7dbaf to your computer and use it in GitHub Desktop.
int main() {
int eleccion;
int numero;
while(eleccion != -1){
printf("\n--BIENVENIDO--\n1.- Agregar\n2.- Eliminar\n3.- Imprimir pila\n4.- Imprimir tamaño\n5.- Comprobar si está vacía\n6.- Mostrar último elemento\n-1.- Salir\n\n\tElige: ");
scanf("%d", &eleccion);
switch(eleccion){
case 1:
printf("Ingresa el número que agregaremos:\n");
scanf("%d", &numero);
agregar(numero);
break;
case 2:
eliminarUltimo();
break;
case 3:
imprimir();
break;
case 4:
printf("La pila mide %d\n", tamanio());
break;
case 5:
if(vacia()){
printf("La pila está vacía\n");
}else{
printf("La pila NO está vacía\n");
}
break;
case 6:
printf("El último elemento es: %d\n", ultimo());
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment