aqui les dejo el codigo para que me puedan ayudar
Código
#include<stdio.h>
#include<conio.h>
#include <stdlib.h>
#define p printf
#define s scanf
main ()
{
int arreglo[10];
int numero=0;
int tope=0;
int x=0;
int contador;
int cantidad;
int final;
do
{
/**COMANDO PARA CAMBIAR COLOR A LA VENTANA**/
system("color 1f");
/** COMANDO PARA LIMPIAR LA PANTALLA **/
system("cls");
/*******************************************/
/*******************************************/
/************ MENU DE OPCIONES **************/
/*******************************************/
/*******************************************/
p("\n\tPOR FAVOR ELIJA UNA DE LAS SIGUIENTES OPCIONES\n\n\n\n");
p("\t\t\tPILA\n");
p("\n\t1.INGRESAR UN DATO A LA PILA \n\n");
p("\t2.MOSTRAR DATOS DE LA PILA\n\n");
p("\t3.ELIMINAR DATO DE LA PILA \n\n");
p("\t4.SALIR DEL PROGRAMA \n");
/***********************************************/
s("%i",&numero);
switch(numero)
{
/*******************************************/
/*******************************************/
/****** AGREGAR ELEMENTO A LA PILA*********/
/*******************************************/
/*******************************************/
case 1:{
system ("cls");
p("CUANTOS ELEMENTOS QUIERE AGREGAR A LA PILA ");
scanf("%d", &cantidad);
for( contador = 1; contador <= cantidad; contador++ ){
p("\t INTRODIZCA EL DATO DE LA PILA NUMERO %d : ", contador);
s("%i",&arreglo[tope]);
tope++;
}
}
break;
/*******************************************/
/*******************************************/
/************ MUESTRA LAS PILA **************/
/*******************************************/
/*******************************************/
case 2:
{
system ("cls");
if ( tope==0 ) {
p("\t LA PILA ESTA VACIA");
}
else
{
p("\tDATOS DE LA PILA\n\n");
for(x=0; tope>x ;x++)
{
p("\n\t%d ",arreglo[x]);
}
}
}
getch();
break;
/*******************************************/
/*******************************************/
/****** ELIMINA DATO DE LA PILA *********/
/*******************************************/
/*******************************************/
case 3:
{
system ("cls");
if (tope==0)
{
p("\n\t\t NO HAY PILA QUE RETIRAR");
getch();
}
else
{
[b] p("CUANTOS DATOS QUIERE QUITAR DE LA PILA \? ");
s("%d",&max);
for ( max = 0; max<tope; max++);
{
tope--;
system ("cls");
p("LOS ELIMENTOS HAN SIDO ELIMINADOS");
[/b]
getch();
}
}
}
break;
/*******************************************/
/*******************************************/
/******** SALE DEL PROGRMA ***********/
/*******************************************/
/*******************************************/
case 6:
{
printf("\tSALIENDO...\n");
return 0;
}
break;
}
}
while(numero<7);
}










Autor


En línea

