该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
aa: return(nusb(head,n));
bb: return(nubs(head,n));
cc: return(nasb(head,n));
dd: return(nabs(head,n));
}
struct data *nusb(struct data *head,int n)
{struct data *p,*p1,*p3,*p2;
int i,j,k;
p2=head;
p1=p2->next;
for(j=1;j<=n-1;j++)
{p2=head;
for(k=1;k<=n-j;k++)
{if((k==1)&&(p2->num>p1->num))
{head=p1;
p1->next=p2;
p2->next=p1->next;
}
else if((p2->num>p1->num)&&(k==2))
{p3=head;
p3->next=p1;
p1->next=p2;
p2->next=p1->next;
}
else{p3=p2;
p2=p1;
p2->next=p1->next;
}
}
}
return(head);
}
struct data *nubs(struct data *head,int n)
{struct data *p,*p1,*p3,*p2;
int i,j,k;
p2=head;
p1=p2->next;
for(j=1;j<=n-1;j++)
{p2=head;
for(k=1;k<=n-j;k++)
{if((k==1)&&(p2->numnum))
{head=p1;
p1->next=p2;
p2->next=p1->next;
}
else if((p2->numnum)&&(k==2))
{p3=head;
p3->next=p1;
p1->next=p2;
p2->next=p1->next;
}
else{p3=p2;
p2=p1;
p2->next=p1->next;
}
}
}
return(head);
}
struct data * nasb(struct data *head,int n)
{struct data *p,*p1,*p2,*p3;
int i,j,k;
p2=head;
p1=p2->next;
for(k=1;k<=n-j;k++)
{if((k==1)&&(strcmp(p2->name,p1->name)>0))
{p2->next=p1->next;
head=p1;
p1->next=p2;
}
else if(strcmp(p2->name,p1->name)>0&&(k==2))
{p3=head;
p3->next=p1;
p1->next=p1->next;
}
else{p3=p2;
p2=p1;
p2->next=p1->next;
}
}
return(head);
}
struct data * nabs(struct data *head,int n)
{struct data *p,*p1,*p2,*p3;
int i,j,k;
p2=head;
p1=p2->next;
for(k=1;k<=n-j;k++)
{if((k==1)&&(strcmp(p2->name,p1->name)<0))
{p2->next=p1->next;
head=p1;
p1->next=p2;
}
else if(strcmp(p2->name,p1->name)<0&&(k==2))
{p3=head;
p3->next=p1;
p1->next=p1->next;
}
else{p3=p2;
p2=p1;
p2->next=p1->next;
}
}
return(head);
}
void alter(struct data *head)
{int q=1;
struct data *p;
char select;
int onu,nnu;
char ona[20],nna[20];
int om,nm;
p=head;
printf("Please select the data type you want to alter:\n");
printf("1->number\n");
printf("2->name\n");
printf("3->money\n");
select=getchar();
if(select=='1')
{printf("Please input the old num:\n");
scanf("%d",&onu);
printf("Please input the new number:\n");
scanf("%d",&nnu);
while(q)
{if(p->num==onu)
{p->num=nnu;
q=q-1;
}
else p=p->next;
if(p==NULL) break;
}
}
else if(select=='2')
{ printf("Please input the old name:\n");
scanf("%s",nna);
q=1;
while(q)
{if(strcmp(p->name,ona)==0)
{strcpy(p->name,nna);
q=0;
}
else p=p->next;
if(p==NULL) break;
}
}
else if(select=='3')
{printf("Please input the old money data:\n");
sanf("%d",&om);
printf("Please input thr new money data:\n");
scanf("%d",&nm);
q=1;
while(q)
{if(p->num==om)
{p->num=nm;
q=q-1;
}
else p=p->next;
if(p==NULL) break;
}
}
else printf("Error\n");
}
void print(struct data *head)
{struct data *p;
printf("Now,the data are:\n");
p=head;
if(head!=NULL)
do{printf("%d,%s,%d\n",p->num,p->name,p->money);
p=p->next;
}while(p!=NULL);
}
struct data *insertdata(struct data *h,struct data *new,int n)
{struct data *p0,*p1,*p2;
p1=h;
p0=new;
if(h==NULL)
{h=p0;
p0->next=NULL;
}
else {while((p0->num>p1->num)&&(p1->next!=NULL))
{p2=p1;
p1=p1->next;
if(p0->num<=p1->num)
{if(h==p1) h=p0;
else p2->next=p0;
p0->next=p1;
}
else{p1->next=p0;
p0->next=NULL;
}
n=n+1;
*t=n;
}
}
return(h);
}
struct data *insertdata2(struct data * h,struct data *new,int n)
{struct data *p0,*p1,*p2;
p1=h;
p0=new;
if(h==NULL)
{h=p0;
p0->next=NULL;
}
else{while(strcmp(p0->name,p1->name)>0&&(p1->next!=NULL))
{p2=p1;
p1=p1->next;
if(strcmp(p0->name,p1->name)<=0)
h=p0;
else p2->next=p0;
p0->next=p1;
}
p1->next=p0;
p0->next=NULL;
n=n+1;
*t=n;
}
return(h);
}
struct data *insert3(struct data *h,struct data *new,int n)
{struct data *p0,*p1,*p2;
p1=h;
p0=new;
if(h==NULL)
{h=p0;
p0->next=NULL;
}
else{while((p0->money>p1->money)&&(p1->next!=NULL))
{p2=p1;
p1=p1->next;
if(p0->money<=p1->money)
{if(h==p1) h=p0;
else p2->next=p0;
p0->next=p1;
}
else{p1->next=p0;
p0->next=NULL;
}
}
n=n+1;
*t=n;
}
return(h);
}
linking ...\LIB\CS.LIB
linking OUTPUT\1.EXE
linker error:undefined symbol _insert1 in module D:\CP\1.C
linker error:symbol _sanf in module D:\CP\1.C
怎么办?
为什么会出现链接错误�