当前位置: 首页>>代码示例>>C++>>正文


C++ Tree::Print方法代码示例

本文整理汇总了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;
}
开发者ID:Fengyou,项目名称:Data-Structure,代码行数:10,代码来源:test.cpp

示例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;
}
开发者ID:Fengyou,项目名称:Data-Structure,代码行数:13,代码来源:test.cpp

示例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();
    }

}
开发者ID:jakesingh,项目名称:binary_tree,代码行数:32,代码来源:binary_tree.cpp

示例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;
}
开发者ID:juravlikk,项目名称:Tree,代码行数:19,代码来源:Tree.cpp

示例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();
}
开发者ID:Fengyou,项目名称:Data-Structure,代码行数:19,代码来源:test.cpp

示例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));
}
开发者ID:Fengyou,项目名称:Data-Structure,代码行数:13,代码来源:test.cpp

示例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;
}
开发者ID:klyuchnikov,项目名称:LabsThreeSemestrsEVM,代码行数:41,代码来源:Main.cpp

示例8: TestTransform

void TestTransform()
{
	t1.Print();
	t1.Transform();
}
开发者ID:Fengyou,项目名称:Data-Structure,代码行数:5,代码来源:test.cpp


注:本文中的Tree::Print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。