main.cpp

来自「二叉树实现,里面含有与二叉树有关的各种方法,希望能给初学数据结构的人员带来启发.」· C++ 代码 · 共 53 行

CPP
53
字号
#include "stdafx.h"
#include "Binary_tree.h"

int main()
{
	Search_tree tree;
	Record record ;
	int chiose;
	
	do 
	{
		show_menu();
		cout << "choise:";
		cin >> chiose;

		switch(chiose)
		{
		case 1:
			cout << "enter record which you want to insert:" ;
			cin >> record;
			cout << "insert result:" << String( tree.insert(record) ) << endl;
			break;
		case 2:
			cout << "enter record which you want to remove:" ;
			cin >> record;
			cout << "remove result:" << String( tree.remove(record) ) << endl;
		    break;
		case 3:
			cout << "which you want to search:" ;
			cin >> record;
			cout << "search result:"<< String( tree.search(record) ) << endl;
		    break;
		case 4:
			cout << "size of tree :" << tree.size() << endl;
		    break;
		case 5:
			cout << "height of tree :" << tree.height() << endl;
		    break;
		case 6:
			tree.clear();
			cout << "clear success!" << endl;
		    break;
		case 7:
			tree.print_tree();
		    break;
		default:
		    return 0;	
		}
	} while(1);

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?