pqlist.cpp

来自「数据结构c++语言描述 Borland C++实现」· C++ 代码 · 共 28 行

CPP
28
字号

#include <iostream.h>
#include "pqlist.h"

void main(void)
{
   MaxPQ<int> H(4);
   int x;
   H.Insert(10).Insert(20).Insert(5);
   cout << "Elements in linear list order " 
        << H << endl;
   try {H.Insert(15);
        cout << "Insert of 15  succeeded" << endl;
        H.Insert(30);
        cout << "Insert of 30  succeeded" << endl;}
   catch (NoMem)
      {cout << "An insert has failed"  << endl;}
   cout << "Elements in linear list order "
        << H << endl;
   cout << "The max element is " << H.Max() << endl;
   H.DeleteMax(x);
   cout << "Deleted max element " << x << endl;
   H.DeleteMax(x);
   cout << "Deleted max element " << x << endl;
   cout << "Elements in linear list order "
        << H << endl;
}

⌨️ 快捷键说明

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