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

📄 deletechainbelt.cpp

📁 一个用于展示数据结构中插入
💻 CPP
字号:
#include"chainbelth.h"




void Deletelist(linklist &l)
{
	int j=0,deletedata,dposition;
	linklist p,q;
	if(l->next!=NULL)
		{
			printf("Please input a position which you want to delete the data on it:\n");
			printf("position=");
			scanf("%d",&dposition);
			p=l;
			while(p->next&&j<dposition-1)
			{
				p=p->next;
				++j;
			}
			if(!(p->next)||j>dposition-1)
				printf("Error! you input is wrong!\n");
			q=p->next;
			p->next=q->next;
			deletedata=q->data;
			free(q);
			printf("The deleted data is:");
			printf("%d\n",deletedata);
			printf("The changed chain belt is:\n");
			printout(l);
			printf("\n");
		}
	else
		printf("Error! There have no datas to delete!\n");
}

⌨️ 快捷键说明

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