}
void View(Stack *temp)
{
while(temp!=NULL)
{
Form1->Memo1->Lines->Add(" "+IntToStr(temp->info));
temp=temp->next;
}
}
void Del_All(Stack **p)
{
Stack *temp=new Stack;
while(*p!=NULL)
{
temp=*p;
*p=(*p)->next;
delete temp;
}
}
void
Poisk(void)
{
Stack *temp,*temp1;
temp=temp1=begin;
while(temp!=NULL)
{
temp1=temp;
while(temp1!=NULL)
{
if((temp->info==temp1->info) && (temp!=temp1))
{
Form1->Memo1->Lines->Add(" "+IntToStr(temp->info));
}
temp1=temp1->next;
}
temp=temp->next;
}
}
void Dobav_n(Stack *p)
{
int x;
while(p!=NULL)
{
x=p->info;
p=p->next;
}
InStack(x);
}
void Dobav_k(Stack *p)
{
int n=p->info;
while(p->next!=NULL)
p=p->next;
Stack *temp=new Stack;
p->next=temp;
p=p->next;
p->info=n;
p->next=NULL;
}
void Dobav(Stack *p, int x)
{
int *A,N=0,i=0;
Stack *temp=p;
while(temp!=NULL)
{ N++; temp=temp->next; }
A=new int[N];
temp=p;
while(temp!=NULL)
{
A[i]=temp->info;
temp=temp->next;
i++;
}
while(p->info!=x)
{ p=p->next; }
if(p->info==x)
{
for(i=0;i<N;i++)
{
Stack *temp1=new Stack;
temp1->info=A[i];
temp1->next=p;
temp1->next=p->next;
p->next=temp1;
}
}
delete A;
}