Treetest.cpp
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- //THE PROGRAM IS TO TEST THE CLASS "TREE" & CLASS "NODE"
- //FILE TREETEST.CPP
- #include <string.h>
- #include <stdio.h>
- #include <conio.h>
- #include "Tree.h"
- int main(void)
- {
- TREE BTREE;
- NODE *TREE_ROOT=0;
- int NUM;
- clrscr();
- BTREE.BUILD_TREE(TREE_ROOT,10);
- BTREE.BUILD_TREE(TREE_ROOT,18);
- BTREE.BUILD_TREE(TREE_ROOT,32);
- BTREE.BUILD_TREE(TREE_ROOT,16);
- BTREE.BUILD_TREE(TREE_ROOT,3);
- BTREE.BUILD_TREE(TREE_ROOT,77);
- BTREE.BUILD_TREE(TREE_ROOT,200);
- printf("nTO DISPLAY THE TREE (INORDER):");
- BTREE.DISPLAY_TREE(TREE_ROOT);
- printf("nnNow,you can search a number in the tree!");
- printf("nnWhat number do you want to search? Input it:");
- scanf("%d",&NUM);
- printf("n");
- BTREE.SEARCH_TREE(TREE_ROOT,NUM);
- getch();
- return 0;
- }