骆寒吧 关注:30贴子:1,407
  • 2回复贴,共1

骆寒我爱你,下面上骆寒帅图

取消只看楼主收藏回复



IP属地:浙江来自Android客户端1楼2014-11-11 18:03回复
    图被狗吃了,那狗还说自己单身


    IP属地:浙江来自Android客户端2楼2014-11-11 18:07
    回复
      #include<stdio.h>
      #include<stdlib.h>
      #define len sizeof(struct node)
      #define null 0
      struct node
      {
      int x;
      struct node*next;
      };
      int n;
      int main()
      {
      int x;
      struct node *head;
      struct node *p1,*p2,*p,*a;
      struct node*del (struct node*head,int x );
      struct node*ins (struct node*head,struct node*x );
      n=0;
      p1=p2=(struct node*)malloc(len);
      scanf("%d",&p1->x);
      head=null;
      while(p1->x!=0)
      {
      n++;
      if(n==1)head=p1;
      else p2->next=p1;
      p2=p1;
      p1=(struct node*)malloc(len);
      scanf("%d",&p1->x);
      }
      p2->next=null;
      p=head;
      while(p!=0)
      {
      printf("%d ",p->x);
      p=p->next;
      }
      scanf("%d",&x);
      p=del(head,x);
      while(p!=0)
      {
      printf("%d ",p->x);
      p=p->next;
      }
      return 0;
      }
      struct node*del (struct node*head,int x )
      {
      struct node *p1,*p2;
      p1=head;
      while(x!=p1->x&&p1->next!=null)
      {
      p2=p1;
      p1=p1->next;
      }
      if(x==p1->x)
      {
      if(p1==head) head=p1->next;
      else p2->next=p1->next;free(p1);
      }return (head);
      }


      IP属地:浙江4楼2015-04-19 19:55
      回复