91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7.2MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-11-13
  • 語言: 其他
  • 標簽:

資源簡介

華工數據結構課程設計源代碼和可執行程序。

資源截圖

代碼片段和文件信息

#include“FamilyTree.h“???

const?char?*filedat=“D:\\FamilyTree.txt“;//家譜文件的默認存儲路徑,可根據需要修改

FamilyTree::FamilyTree()???
{???
????T=NULL;//開始為空家譜???
}???
???
FamilyTree::~FamilyTree()???
{???
????DeleteFamilyTree();//釋放資源???
}???
???
void?FamilyTree::NewFamilyTree()???
{???
????//建立一空家譜???
????DeleteFamilyTree();//刪除原有家譜???
????T=NULL;???
}???
???
void?FamilyTree::CreateFamilyTree()???
{???
????DeleteFamilyTree();
//刪除原來家譜樹結構???
????int?n=0;
//初始化數組下標,用來看有幾個數據???
????fstream?f(filedatios::binary|ios::in);
//以二進制讀方式打開???
????if(!f)???
????{???
????????cerr<<“Failed?to?open!“< //不能打開,顯示出錯信息???
????????return;???
????}
else
{
f.seekg(0ios::end);
//指針移到文件尾???
????????long?posEnd=f.tellg();
//記錄文件尾位置???
????????f.seekg(0ios::beg);
//指針移到文件頭???
????????person?ParentT=new?CSNode;?
????????ParentT=NULL;
????????person?temp[max_char_num];
//定義讀取數據的數組???
for(int?i=0;i????????temp[i]=new?CSNode;
//初始化一個地址值,且不能為空否則出錯???
????????if(?posEnd?==?f.tellg(?)?)
{???
cout<<“This?is?an?empty?family?tree!“< //文件頭與文件尾相同,說明文件無數據,為空樹
f.close();//關閉文件流
return;???
}
while(?posEnd?!=?f.tellg()?)
//從頭到尾讀取二進制數據???
{???
f.read((char*)&(temp[n]->data)sizeof(Info));???
n++;
}
NewFamilyTree();???
?????????T=temp[0];T->firstchild=T->nextsibling=NULL;
?//將第一個賦給根結點
?for(int?j=1;j ?//其余繼續用類似Add()函數來添加進樹里???
?{
?FindName(TParentTtemp[j]->data.fathername);
?if(ParentT)
?{
?temp[j]->firstchild=temp[j]->nextsibling=NULL;
?temp[j]->parent=ParentT;
?if(ParentT->firstchild)???
?????????????????{???
???????????????????????InsertSibling(ParentT->firstchildtemp[j]);???
??????????????????}???
?????????????????else
?ParentT->firstchild=temp[j];?
?}
?}
cout<<“Successfully?reading!“< }
????f.close();
//關閉文件流???
}
???
void?DestroyNode(person?&pnode)???
{???
????//刪除一結點???
????if(pnode)???
????{???
????????delete?pnode;???
????????pnode=NULL;???
????}???
}???
???
??
void?FamilyTree::DeleteFamilyTree()???
{???
????//刪除家譜,釋放資源???
????PostOrderTraverse(TDestroyNode);???
}???
???
void?FamilyTree::PostOrderTraverse(person?&Tvoid?(__cdecl?*Visit)(person?&T))???
{???
????//后序遍歷二叉樹,并執行visit函數???
????if(T)???
????{???
????????PostOrderTraverse(T->firstchildVisit);???
????????PostOrderTraverse(T->nextsiblingVisit);???
????????(*Visit)(T);???
????}???
}???
???
void?FamilyTree::PreOrderTraverse(fstream?&fperson?&T?void?(__cdecl?*Visit)(fstream?&fperson?&T))???
{???
????//先序遍歷二叉樹,并執行visit函數???
????if(T)???
????{???
????????(*Visit)(fT);???
????????PreOrderTraverse(fT->firstchildVisit);???
????????PreOrderTraverse(fT->nextsiblingVisit);???
????}???
}???
???
void?SaveNode(fstream?&f?person?&pnode)???
{???
????//以二進制形式保存一個結點的info信息???
????if(pnode)???
????{???
????????f.write?(?(char?*?)&pnode->data?sizeof(Info)?)?;???
????}???

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2138??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\cl.command.1.tlog

?????文件??????95124??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\CL.read.1.tlog

?????文件???????1438??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\CL.write.1.tlog

?????文件?????127488??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\FamilyTree.exe

?????文件?????943308??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\FamilyTree.ilk

?????文件?????????59??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\FamilyTree.lastbuildstate

?????文件???????1450??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\FamilyTree.log

?????文件?????358737??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\FamilyTree.obj

?????文件????1240064??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\FamilyTree.pdb

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link-rc.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link-rc.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.3740-cvtres.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.3740-cvtres.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.3740-rc.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.3740-rc.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.3740.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.3740.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.6512-cvtres.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.6512-cvtres.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.6512-rc.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.6512-rc.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.6512.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.6512.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.780-cvtres.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.780-cvtres.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.780-rc.read.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.780-rc.write.1.tlog

?????文件??????????2??2015-03-01?12:08??華工數據結構課程設計\FamilyTree\Debug\link.780.read.1.tlog

............此處省略22個文件信息

評論

共有 條評論