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

📄 test02_1.cpp

📁 该包是数据结构的实验软件,来源于合肥工业大学人工智能与数据挖掘实验室,用来实现数据结构.
💻 CPP
字号:
// test02_1}
#include "linklist.h"


void copy1(link l,link &l1)
{
	link p,r,s;
	p=l->next;
	l1=(link)malloc(sizeof(struct node));
	r=l1;
	while (p!=NULL){
		s=(link)malloc(sizeof(struct node));
		s->data=p->data;
		r->next=s;
		r=s;
		p=p->next;
	}
	r->next=NULL;
}

void copy2(link l,link &l1)
{
	if (l!=NULL){
		l1=(link)malloc(sizeof(struct node));
		l1->data=l->data;
		copy2(l->next,l1->next);
	}else l1=NULL;
}


void main()
{
	link l,l1,l2;
	load_hsllist(l); 
	comput_sllist_card(l,50,100); 
	disp_hsllist("Sllist",l);
	getch();
	copy1(l,l1);
	comput_sllist_card(l1,50,250); 
	disp_hsllist("copy1",l1);
	getch();
	copy2(l,l2);
	comput_sllist_card(l2,50,400); 
	disp_hsllist("copy2",l2);
	getch();
}

⌨️ 快捷键说明

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