⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pex11_5.cpp

📁 数据结构C++代码,经典代码,受益多多,希望大家多多支持
💻 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 + -