本文整理汇总了C++中Tree::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ Tree::Print方法的具体用法?C++ Tree::Print怎么用?C++ Tree::Print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::Print方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestFarthest
void TestFarthest()
{
cout << "TestFarther()--------------------------------------------------" << endl;
t1.Print();
cout << t1.GetFarthest() << endl;
t2.Print();
cout << t2.GetFarthest() << endl;
}
示例2: TestIsComplete
void TestIsComplete()
{
cout << "TestIscomplete()--------------------------------------------------" << endl;
t0.Print();
cout<<t0.IsComplete()<<endl;
t1.Print();
cout << t1.IsComplete() << endl;
t2.Print();
cout<<t2.IsComplete()<<endl;
}
示例3: main
int main()
{
int select = -1;
Tree tree;
while (true) {
cout << "0: Exit" << endl;
cout << "1: Add" << endl;
cout << "2: Search" << endl;
cout << "3: Load Preset Tree" << endl;
cout << "4: Print" << endl;
cin >> select;
if (select == 0)
return 0;
if (select == 1)
tree.EnterID();
if (select == 2)
tree.Search();
if (select == 3)
tree.Preset();
if (select == 4)
tree.Print();
}
}
示例4: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
Tree<int>* tr = new Tree<int>();
tr->Add(123, "abcdef");
tr->Add(456, "abde");
tr->Add(789, "aaaa");
tr->Add(145, "a");
tr->Add(464, "ab");
tr->Print("Tree");
cout << endl;
tr->Add(444, "a");
cout << endl;
tr->Find("abde");
cout << endl;
tr->Delete("abde");
tr->Print("After deleting record (key - abde)");
getchar();
return 0;
}
示例5: TestTree
void TestTree()
{
cout << "TestTree()--------------------------------------------------" << endl;
int prev0[] = { 1, 2, 4, 3, 5 };
int in0[] = { 4, 2, 1, 5, 3 };
Tree<int> t0(prev0, sizeof(prev0)/sizeof(prev0[0]), in0, sizeof(in0)/sizeof(in0[0]));
t0.Print();
int prev1[] = { 1, 2, 3, 4, 5, 6 };
int in1[] = { 3, 2, 4, 1, 6, 5 };
Tree<int> t1(prev1, sizeof(prev1)/sizeof(prev1[0]), in1, sizeof(in1)/sizeof(in1[0]));
t1.Print();
int prev2[] = { 1, 2, 4, 5, 3, 6, 7 };
int in2[] = { 4, 2, 5, 1, 6, 3, 7 };
Tree<int> t2(prev2, sizeof(prev2)/sizeof(prev2[0]), in2, sizeof(in2)/sizeof(in2[0]));
t2.Print();
}
示例6: TestGrandfather
void TestGrandfather()
{
cout << "TestGrandfather()--------------------------------------------------" << endl;
t1.Print();
//int x = 6;
//cout << t1.Find(x) << endl;
int x = 3;
int y = 6;
t1.GetNearestGandfather(t1.Find(x),t1.Find(y));
}
示例7: menu
void menu()
{
Tree *tree = new Tree;
char c;
do
{
printf("1: View\n");
printf("2: Find\n");
printf("3: Add\n");
printf("4: Del\n");
printf("5: Clear\n");
printf("\nEsc: Exit\n");
c = getch();
switch(c)
{
case '1':
cout << "Print:";
tree->Print();
cout << endl; break;
case '2':
cout << "Find:";
int val;
cin >> val;
bool flag;
flag = tree->Exists(val);
cout << (flag == true ? "true" : "false") << endl; break;
case '3':
cout << "Add:";
int add;
cin >> add;
tree->Add(add); cout << endl; break;
case '4':
cout << "Delete:";
int del;
cin >> del;
tree->Delete(del); cout << endl; break;
case '5': tree->Clear(); cout << endl; break;
}
} while(c != 27);
delete tree;
}
示例8: TestTransform
void TestTransform()
{
t1.Print();
t1.Transform();
}