thanks to all .please send to me more programes

--- dhaval shah <[EMAIL PROTECTED]> wrote:

> #include<stdio.h>
> #include<conio.h>
> #define N 5
> int top=-1,i,x;
> void push(int s[N]);
> void pop(int s[N]);
> void peep(int s[N]);
> void change(int s[N]);
> void dis(int s[N]);
> void main()
> {
>  int x=1,s[N];
>  clrscr();
>  while(x!=6)
>  {
>   clrscr();
>   printf("\n1:    push");
>   printf("\n2:    pop");
>   printf("\n3:    peep");
>   printf("\n4:    change");
>   printf("\n5:    display");
>   printf("\n6:    exit");
>   printf("\n\nEnter ur option: ");
>   scanf("%d",&x);
>   switch (x)
>   {
>    case 1:
>     push(s);
>     break;
>    case 2: pop(s);
>     break;
>    case 3: peep(s);
>     break;
>    case 4: change(s);
>     break;
>    case 5: dis(s);
>     break;
>    case 6: break;
>    default:
>     printf("\nenter the right option");
>     getch();
>   }
>  }
> }
> void push(int s[])
> {
>  clrscr();
>  if(top>=N-1)
>   {
>   printf("overflow");
>   getch();
>   }
>   else
>   {
>   top++;
>   printf("enter the no: ");
>   scanf("%d",&s[top]);
>   dis(s);
>   }
> }
> void pop(int s[])
> {
>  clrscr();
>  if(top<0)
>  {
>  printf("underflow on pop");
>  }
>  else
>  {
>  x=s[top];
>  printf("the number poped is %d :",x);
>  top--;
>  dis(s);
>  }
>  getch();
> }
> void peep(int s[])
> {
>  printf("enter the index u want :");
>  scanf("%d",&i);
>  if(top-i+1<0)
>  {
>  printf("stack underflow on peep");
>  }
>  else
>  {
>  printf("the peeped no is %d\n",s[top-i+1]);
>  }
>  dis(s);
>  getch();
> }
> void change(int s[])
> {
>  printf("enter the index which u want to b
> changed");
>  scanf("%d",&i);
>  if(top-i+1<0)
>  printf("stack underflow on change");
>  else
>  {
>  printf("\nenter the no:");
>  scanf("%d",&x);
>  s[top-i+1]=x;
>  printf("the changed no is %d",s[top-i+1]);
>  }
>  dis(s);
> }
> void dis(int s[])
> {
>  for(i=top;i>=0;i--)
>  printf("\n%d",s[i]);
>  getch();
> }
> 
>        
> ---------------------------------
>  Why delete messages? Unlimited storage is just a
> click away.
> 
> [Non-text portions of this message have been
> removed]
> 
> 



      Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/

Reply via email to