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

📄 doublechain.cpp

📁 常用算法与数据结构原代码
💻 CPP
字号:

// test iterators for doubly-linked list

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

void main(void)
{
	DoubleChain<int> L;
	L.Insert(0,2);
	L.Insert(1,6);
	L.Insert(2,8);
	L.Insert(1,4);
	cout << "List is " << L << endl;
	L.ResetLeft();
	if (L.Front())
		cout << "Positioned at front of list ";
	if (!L.End())
		cout << "but not at the end" << endl;
	cout << "List in sequence is ";
	int x;
	while (L.Current(x)) 
	{
		cout << x << ' '; 
		L.Next();
	}
	cout << endl;
	
	L.ResetRight();
	if (L.End())
		cout << "Positioned at end of list ";
	if (!L.Front())
		cout << "but not at the front" << endl;
	
	cout << "List in reverse order is ";
	while (L.Current(x)) 
	{
		cout << x << ' '; 
		L.Previous();
	}
	cout << endl;
}

⌨️ 快捷键说明

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