Шпаргалка: Реализация списка
}
int TreeWork::PrintList()
{if (BegP==NULL)
{cout<<endl<<"The list is empty!"<<endl; return -1;}
cout<<endl<<"Total elements: "<<ElementQuantity<<endl;
PList=BegP;
int i=1;
do
{cout<<endl<<" "<<i<<" element: "<<endl;
GoThroughTree(PList->Root);
cout<<endl;
i++;
PList=PList->LNext;}
while (PList!=BegP);
return 0;
}
void TreeWork::GoThroughTree(Tree *L)
{Tree *PL=L, *PL1;
if (PL->LP!=NULL)
{PL1=PL;
PL=PL->LP;
cout<<"("<<PL1->Body<<","<<PL->Body<<") ";
GoThroughTree(PL);}
if (PL->RP!=NULL)
{PL1=PL;
PL=PL->RP;
cout<<"("<<PL1->Body<<","<<PL->Body<<") ";
GoThroughTree(PL);}
}