linkstruct.cpp

来自「关于数据结构的相关内容,表达式树,前中后序遍历,哈夫曼编码,线性表操作」· C++ 代码 · 共 64 行

CPP
64
字号
// LinkStruct.cpp : 定义控制台应用程序的入口点。
//


#include "Interface.cpp"
#include<iostream>
#include<time.h>
using namespace std;


int main()
{
//	Chain<int> MyChain;
//
//	srand(time(NULL));				//这个是产生随机数的函数,需要加入<time.h>和<stdlib.h>,调用这个函数后
//	for(int i=1;i<11;i++)		    //就可以用rand()函数产生随机数,如果想产生1~10之间的随机数,就用rand()%10
//	{								//模10就可以产生1~10之间的随机数
//		MyChain.Insert(1,rand()%10+10);
//	}
//
//	int finddata;
//	if(MyChain.Find(2,finddata))		//查找第二个元素,将将其返回给finddata;
//		cout<<"The second node you find is: "<< finddata<<endl;
//	 
//	int searchdata=5;					//这个是按值查找,如果找到了就返回下标
//	if(MyChain.Search(searchdata))
//	{
//		cout<<"The index of the data you find is: "<<MyChain.Search(searchdata)<<endl;
//	}
//	else
//	{
//		cout<<"There is no element with this searched value.\n";
//	}
//
//	MyChain.Delete(1,finddata);
//	cout<<"You have deleted the first data of the linklist: "<<finddata<<endl;
//
//	cout<<MyChain;			//输出链表
//
//	MyChain.Sort();			//排序
//	cout<<"\nAfter Sorting: "<< endl << MyChain << endl;
//
//	Chain<int> ConChain;				//同理,创建第二个链表
///*	srand(time(NULL))*/;    //由于上面已经执行过这个函数,这里可以不用再执行
//	for(int i=1;i<11;i++)
//	{
//		
//		ConChain.Insert(1,rand()%10+10);
//	}
//	ConChain.Sort();
//
//	cout<<"\nThe anthor chain is : \n"<<ConChain;
//
//	Chain<int> CombineChain;				//第三个链表,用来将前两个链表合并
//	CombineChain.Combination(MyChain,ConChain);
//	cout<<"\nAfter Combination of the two; \n" << CombineChain;


	Interface<int> MyInterface;
	MyInterface.Operation();
	return 0;
}

⌨️ 快捷键说明

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