Реферат: Программирование на С++
}
int TreeWork::SubWork(int Task)
{switch (Task)
{case 1 : SortByIncrease(); break; //Increase
case 2 : SortByDecrease(); break; //Decrease
}
return 0;
}
int TreeWork::Work(int Task)
{switch (Task)
{case 1 : ElementQuantity=MakeNewList(); break; //Make New List
case 2 : ElementQuantity+=AddElements(); break; //Add Element
case 3 : PrintList(); break; //Print List
case 4 : DeleteElement(); break; //Delete Element
case 5 : SaveList(); break; //Save List
case 6 : ElementQuantity=0; EraseList(); break; //Erase List
case 7 : OpenList(); break; //Open File
case 8 : FindElement(); break; //Find Element
case 9 : SubWork(SubMenu()); break; //Sort List
case 0 : EraseList(); return -1; //Exit
}
return 0;
}
void TreeWork::TreeWorkStart()
{ElementQuantity=0;
do {} while (Work(MainMenu())!=-1);
}
int TreeWork::MakeNewList()
{if (BegP!=NULL)
{cout<
int Quant;
cout<
do
{cin>>Quant; if (Quant<1) cout< }
while (Quant<1);
for (int i=0; i
{cout< int Digit; cin>>Digit; PList=new List(Digit); if (BegP==NULL) {BegP=PList; BegP->LNext=BegP; BegP->LPrev=BegP; PList=NULL;}
else
{List *PList1=BegP->LPrev; if (PList1==BegP) {BegP->LNext=PList; BegP->LPrev=PList; PList->LNext=BegP; PList->LPrev=BegP; PList=NULL; PList1=NULL;}
else
{BegP->LPrev=PList; PList1->LNext=PList; PList->LNext=BegP; PList->LPrev=PList1; PList=NULL; PList1=NULL;}
}
}
return Quant;
}