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

📄 double.cpp

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


// test doubly linked class

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

void main(void)
{
   try {
      Double<int> L;
      cout << "Length = " << L.Length() << endl;
      cout << "IsEmpty = " << L.IsEmpty() << endl;
      L.Insert(0,2).Insert(1,5).Insert(2,7).Insert(3,8);
      L.Insert(1,3).Insert(0,1).Insert(4,6).Insert(7,9);
      cout << "List is " << L << endl;
      cout << "IsEmpty = " << L.IsEmpty() << endl;
      int z;
      L.Find(1,z);
      cout << "First element is " << z << endl;
      L.Find(8,z);
      cout << "Eighth element is " << z << endl;
      L.Find(4,z);
      cout << "Fourth element is " << z << endl;
      cout << "Length = " << L.Length() << endl;
      cout << "8 is in position " << L.Search(8) << endl;
      cout << "1 is in position " << L.Search(1) << endl;
      cout << "10 is in position " << L.Search(10) << endl;
      cout << "6 is in position " << L.Search(6) << endl;
      L.Delete(1,z);
      cout << "Deleted element from position 1 is " << z << endl;
      cout << "List is " << L << endl;
      L.Delete(7,z);
      cout << "Deleted element from position 7 is " << z << endl;
      cout << "List is " << L << endl;
      L.Delete(3,z);
      cout << "Deleted element from position 3 is " << z << endl;
      cout << "List is " << L << endl;
      int z1, z2, z3;
      L.Delete(5,z1).Delete(1,z2).Delete(3,z3);
      cout << "Deleted elements are " << z1
           << "  " << z2 << "  " << z3 << endl;
      cout << "List is " << L << endl;
      L.Delete(1,z1).Delete(1,z2);
      cout << "Deleted elements are " << z1
           << "  " << z2 << endl;
      cout << "List is " << L << endl;
      L.Insert(0,5);
      cout << "List is " << L << endl;
      }
   catch (...) {
      cerr << "An exception has occurred" << endl;
      }
}

⌨️ 快捷键说明

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