📄 insertchainbelt.cpp
字号:
#include"chainbelth.h"
void Insertlist(linklist &l)
{
linklist p,q;
int j=0,insertdata,iposition;
p=l;
if(l->next!=NULL)
{
scanf("%d",&insertdata);
printf("position=");
printf("Please input a data which you want to add to the chain belt and the position:\n");
printf("data=");
scanf("%d",&iposition);
while(p&&j<iposition-1)
{
p=p->next;
++j;
}
if(!p||j>iposition-1)
printf("Error! The position is wrong!\n");
q=(linklist)malloc(sizeof(Lnode));
if(!q)
printf("Error! Do not have enough EMS memory interspace!\n");
q->data=insertdata;
q->next=p->next;
p->next=q;
printf("The changed chain belt is:\n");
printout(l);
printf("\n");
}
else
printf("You do not have created a chain belt before,please create first:\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -