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

📄 main.cpp

📁 模块化的链表的示例
💻 CPP
字号:
#include "class.h"
#include <iostream.h>
#include <time.h>
#include <stdlib.h>


void main( void )
{
	time_t t = 0;
	srand( ( unsigned ) time( & t ) ); 

	int uii = 0, uij = 0;
	cout << "Please input the node's number:   ";
	cin >> uii;
	while ( ( uii < 1 ) || ( uii > MAXSIZE ) )
	{
		cout << "Bad input, try again" << endl;
		cin >> uii;
	}
    clsList_c cllist( uii );
	cout << "The created list is:" << endl;
	cllist.PrintList();
	cllist.IsFull();
	cout << "Please input the node's value and it's position:   " << endl;
	cin >> uii >> uij;
	while ( ( uii < 0 ) || ( uii > MAXSIZE ) )
	{
		cout << "Bad input, try again" << endl;
		cin >> uii >> uij;
	}
	cllist.Insert( uii, uij );
	cout << "The inserted list is:" << endl;
	cllist.PrintList();
	cout << "Now you can input a position to delete a node:" << endl;
	cin >> uii;
	while ( ( uii < 0 ) || ( uii > MAXSIZE ) )
	{
		cout << "Bad input, try again" << endl;
		cin >> uii;
	}
	cllist.Delete( uii );
	cout << "The deleted list is:" << endl;
	cllist.PrintList();
	cllist.IsFull();
	cllist.IsEmpty();


	clsList_c cllist2( cllist );
	cout << "The new list is created and it is:" << endl;
	cllist2.PrintList();

	clsList_c cllist3;
	cllist3 = cllist;
	cout << "The new list is created and it is:" << endl;
	cllist3.PrintList();

	clsList_c cllist4;
	cllist4 = cllist3 + cllist2;
	cllist4.PrintList();
}

⌨️ 快捷键说明

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