小甲鱼老师视频:结构与共同体06链表多次插入主函数实现部分
void main (){
struct student *creat(struct student *head); //链表建立函数
struct student *del(struct student *head,int num); //链表删除函数
struct student *insert(struct student *head,struct student *stu); //链表插入函数
void print(struct student *head); //链表打印函数
int m;
struct student *head,*stu;
head=NULL;
head=creat(head);
print(head);
printf("\n");
printf("Please input the num you want to delete:");
scanf("%d",&m);
printf("\n");
print(del(head,m));
printf("\n");
stu=(struct student *)malloc(sizeof(struct student));
printf("Please input the num you want to insert:");
scanf("%d",&stu->num);
printf("Please input the score you want to insert:");
scanf("%d",&stu->score);
#if(1)
while(stu->num!=0)//实现多次插入!
{
printf("\n");
head=insert(head,stu);
print(head);
stu=NULL;
stu=(struct student *)malloc(sizeof(struct student));//重新向系统申请分配节点;
printf("Please input the num you want to insert:");
scanf("%d",&stu->num);
printf("Please input the score you want to insert:");
scanf("%d",&stu->score);
}
#else
printf("\n");
head=insert(head,stu);//实现单次插入
print(head);
#endif
} 拿钱来的。。。。。。。。 :D:D高手啊 这个为什么会循环输出呢,在视频里面 C语言小跟班 发表于 2019-4-11 19:12
**** 作者被禁止或删除 内容自动屏蔽 ****
同问 这个为什么会循环输出呢,在视频里面
页:
[1]