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

📄 lwbase.h

📁 一本全面剖析C++数据结构算法的书籍
💻 H
字号:
// file lbase.h// base class for linked graph representations#ifndef LinkedBase_#define LinkedBase_#include "keychain.h"#include <iostream.h>template<class type>class LinkedBase {   public:      LinkedBase(int Vertices = 10);      ~LinkedBase() {delete [] h;}      int Edges() {return e;}      void Print();   protected:      int n; // number of vertices      int e; // number of edges      KeyedChain<type> *h; // 1D array};template<class type>LinkedBase<type>::LinkedBase(int Vertices){   n = Vertices; e = 0;   h = new KeyedChain<type> [n+1];   if (!h)    {cerr << "Out Of Memory" << endl;     exit(1);}}template<class type>void LinkedBase<type>::Print(){   for (int i = 1; i <= n; i++) {      cout << "Vertex " << i << " = ";      h[i].Print();}}#endif

⌨️ 快捷键说明

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