📄 pex11_5.cpp
字号:
#include <iostream.h>
#pragma hdrstop
#include "bstree.h"
#include "wex11_22.h"
#include "wex11_23.h"
#include "random.h"
void main(void)
{
BinSTree<int> tree;
RandomNumber rnd;
// compute max/min as they are generated as a check on
// the functions Max/Min
long max=-1, min = 10001;
int randval;
// create tree with 500 nodes whose data values are in
// the range 1..10000. compute max/min
for(int i=0;i < 500;i++)
{
randval = rnd.Random(10000)+1;
if (randval > max)
max = randval;
if (randval < min)
min = randval;
tree.Insert(randval);
}
cout << "max/min values of the original data values are "
<< max << '/' << min << endl;
cout << "functions Max()/Min() return " << Max(tree.GetRoot())->data
<< '/' << Min(tree.GetRoot())->data << endl;
}
/*
<Run>
max/min values of the original data values are 9998/23
functions Max()/Min() return 9998/23
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -