11.cpp
来自「关于BST的基本功能和基本操作~适合初初学者使用~」· C++ 代码 · 共 39 行
CPP
39 行
#include <iostream>
#include "BST.h"
using namespace std;
int main()
{
bstree t1;
node *p=t1.get_root();
if(p==NULL) return 0;
cout <<"do you want to creat the leftchild?y/n";
char cha;
cin >>cha;
if(cha=='Y'||cha=='y')
{
cout <<"Please enter your data ,thank you ~:";
int dat1;
cin >>dat1;
node *n=t1.get_root();
t1.creat_trees(t1.ret_left(n),dat1);
}
cout <<"do you want to creat the rightchild?y/n";
char cha1;
cin >>cha1;
if(cha1=='Y'||cha1=='y')
{
cout <<"Please enter your data ,thank you ~:";
int dat1;
cin >>dat1;
node *n=t1.get_root();
t1.creat_trees(t1.ret_righ(n),dat1);
}
t1.mid_show();
system("pause");
int flag=0;
t1.judge(t1.get_root(),flag);
if (flag==0) cout <<"BST"<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?