终极第八季修订版.docVIP

  • 2
  • 0
  • 约1.45万字
  • 约 27页
  • 2018-08-22 发布于贵州
  • 举报
终极第八季修订版

71. #includestdio.h #includestdlib.h struct stu{ int no; char name[20]; int age; struct stu *next; }; void ptf(struct stu *head) { struct stu *p2; p2=head; printf(%d ,p2-no); p2=p2-next; while(p2-next!=NULL) { printf(%d ,p2-no); p2=p2-next; } printf(\n); } int main() { int n=0,t; struct stu *head,*p1,*p2; p1=p2=(struct stu *)malloc(sizeof(struct stu)); do{ n++; if(n==1)head=p1; else p2-next=p1; p2=p1; scanf(%d,p1-no); if(p1-no==0)break; scanf(%s%d,p1-name,p1-age); p1=(struct stu *)malloc(sizeof(struct stu)); }while(1); p1-next=NULL; scanf(%d,t); ptf(head); p2=head; if(p2-no==t)head=p2-next; else{ while(p2-next!=NULLp2-next-no!=t) { p2=p2-next; } if(p2-next-no==t)p2-next=p2-next-next; } ptf(head); return 0; } 72 #include stdio.h #include stdlib.h struct worker { int num; struct worker *next; }; struct worker *create(int n) { int i; struct worker *head,*pnew,*pend; pnew=(struct worker*)malloc(sizeof(struct worker)); scanf(%d,pnew-num); head=pend=pnew; for(i=1;in;i++) { pnew=(struct worker*)malloc(sizeof(struct worker)); scanf(%d,pnew-num); pend-next=pnew; pend=pnew; } pend-next=NULL; return head; } void print(struct worker *head) { struct worker *p=head; while(p!=NULL) { printf(%d ,p-num); p=p-next; } } int main() { struct worker *head; int n; scanf(%d,n); head=create(n); print(head); printf(\n); return 0; } 73 #include stdio.h #include string.h #include stdlib.h void cheng(char a[],char b[]) { ?int i,j,ca,cb,*s; ??? ca=strlen(a); ??? cb=strlen(b); ??? s=(int *)malloc(sizeof(int)*(ca+cb));?? ??? for (i=0;ica+cb;i++) s[i]=0;?????????? ??? for (i=0;ica;i++) ??????? for (j=0;jcb;j++) ??????????? s[i+j+1]+=(a[i]-0)*(b[j]-0); ????????????? ??? for (i=ca+cb-1;i=0;i--)??????? ??????? if (s[i]=10) ??????? { ??????????? s[i-1]+=s[i]/10; ??????????? s[i]%=10; ??????? } ??? i=0; ?while(s[i]==0) i++;?? ?for (;ica+cb;i++) printf(%d,s[i]); ??? printf(\n); ??? free(s); } int main() { ?c

文档评论(0)

1亿VIP精品文档

相关文档