c语言程序怎样才会报错,c语言程序在运行时出现“未处理的win32”异常是怎么会是?...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

{

p1=p2;

p2=p2->next;

}

if (p2->data==num)

{

p1->next=p2->next;

delete p2;

cout<

}

else cout<

}

return(head);

}

//释放链表的结点空间

void deletechain(node *h)

{

node *p1;

while(h)

{

p1=h;

h=h->next;

delete p1;

}

cout<

}

int count(node *head)//求链表的结点数

{

int n;

node *p;

p=head;

n=0;

while(p!=NULL)

{

n=n+1;

p=p->next;

} return(n);

}

//删除链表上第k 个结点

node *delete_k_node(node *head,int k)

{

int j=1;

node *p,*p1;

if(head==NULL)

{

cout<

return(NULL);

}

p=head;

if (k==1)

{

p=head;

head=head->next;

delete p;

cout<

}

else

{

p=find(head,k-1); //查找第k-1 个结点,并由p 指向该结点

if (p->next!=NULL)

{

p1=p->next;

p->next=p1->next;

delete p1;

cout<

}

return(head);

}

}

void main(void)

{

node *head;

int num;

int k;

head=create_sort();

print(head);

cout<

cout<

cin>>num;

head=delete_k_node(head,k);

print(head);

cout<

cin>>num;

head=delete_one_node(head,num);

print(head);

deletechain(head);

cout<

cin>>num;

head=insert(head,num);

print(head);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值