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

📄 bst3.cpp

📁 数据结构c++语言描述 Borland C++实现
💻 CPP
字号:

#include <iostream.h>
#include "bst3.h"
#include "datatype.h"

BSTree<DataType,int> y;

void main(void)
{
   DataType q;
   q.key = 1; q.ID = 'a';
   y.Insert(q);
   q.key = 6; q.ID = 'b';
   y.Insert(q);
   q.key = 4; q.ID = 'c';
   y.Insert(q);
   q.key = 8; q.ID = 'd';
   y.Insert(q);
   cout << "Elements in ascending order are" << endl;
   y.Ascend();
   DataType s;
   y.DeleteMax(s);
   cout << "Delete of max element succeeds " << endl;
   cout << s.key << ' ' << s.ID << endl;
   cout << "Elements in ascending order are" << endl;
   y.Ascend();
   y.DeleteMax(s);
   cout << "Delete of max element succeeds " << endl;
   cout << s.key << ' ' << s.ID << endl;
   cout << "Elements in ascending order are" << endl;
   y.Ascend();
   y.DeleteMax(s);
   cout << "Delete of max element succeeds " << endl;
   cout << s.key << ' ' << s.ID << endl;
   cout << "Elements in ascending order are" << endl;
   y.Ascend();
   try {y.Delete(6,s);}
   catch (BadInput)
      {cout << "Delete of 6 fails " << endl;}
   cout << "Elements in ascending order are" << endl;
   y.Ascend();
}

⌨️ 快捷键说明

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