binarytree.cpp

来自「遍历线索二叉树 遍历线索二叉树」· C++ 代码 · 共 53 行

CPP
53
字号
// BinaryTree.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "BinTree.h"
#include <windows.h>
#include <tchar.h>
#include <assert.h>
#include <strsafe.h>
#include <exception>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	TCHAR szCWD[MAX_PATH] = {};
	TCHAR szPath[MAX_PATH] = {};
	DWORD dwRet;

	dwRet = GetCurrentDirectory(MAX_PATH ,szCWD);
	wprintf(L"%s\n" , szCWD);
	
	if(SUCCEEDED(StringCchCopy(szPath , MAX_PATH , szCWD)))
	wprintf(L"%s\n" , szPath);

	int ai[8] = {4 , 3 , 1 ,2 ,5 ,7 ,6 ,8};
	ThreadBinTree<int> *p =new ThreadBinTree<int>(ai[0]);

	for(int i=1 ; i<8 ; i++)
	{	
		try
		{
			p->BuildSortTree(ai[i]);
		}
		catch(...)
		{
			throw(1);
		}
	}

	printf("%d\n" , p->Find(ai[3]));

	ThreadPreOrderTree<int> *it = new ThreadPreOrderTree<int>(p);
//	it->CreatePreThread();


	delete p;

	getchar();
	return 0;
}

⌨️ 快捷键说明

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