Шпаргалка: Реализация списка
}
int TreeWork::SortByDecrease()
{
if(BegP==NULL) {cout<<endl<<"Error!"<<endl; return -1;}
List *PList1=BegP; PList=BegP;
do
{do
{if (PList1->Root->Body<PList->Root->Body)
{Tree *PT;
PT=PList1->Root;
PList1->Root=PList->Root;
PList->Root=PT;
PT=NULL;}
PList1=PList1->LNext;
}
while (PList1!=BegP);
PList=PList->LNext;
}
while (PList!=BegP);
return 0;
}
int TreeWork::SaveList()
{if (BegP==NULL)
{cout<<endl<<"The list is empty!"<<endl; return -1;}
ofstream F;
char *FileName=new char[25];
cout<<endl<<"Input file name: "; cin>>FileName;
F.open(FileName);
PList=BegP;