?? del_increase'linklist.cpp
字號:
#include<stdio.h>
#include<malloc.h>
typedef struct node
{ int data;
struct node *next;
} Linklist;
void Del_increaseLinklist(Linklist *&L,int n)
{ Linklist *p=L->next,*q;
int i;
for(i=0;i<n;i++)
scanf("%d",&(L->data));
while(p->next!=NULL)
{ if(p->data==p->next->data)
{ q=p->next;
p->next=q->next;
free(q);
}
else
p=p->next;
}
}
void print_list(Linklist *L)
{ Linklist *r;
r=L->next;
printf("the result is : \n");
while(r!=NULL)
{ printf("%5d",r->data);
r=r->next;
}
printf("\n");
}
void main()
{ Linklist *a;
printf("Delete the same node in the increase Sqlist: \n");
Del_increaseLinklist(a,5);
print_list(a);
getchar();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -