id
int32
0
32.5k
code
stringlengths
95
8.4k
label
stringclasses
65 values
15,400
struct node { char data[10][20]; struct node *pre; }; int main () { int i,j; struct node *p1,*p2; p1=(struct node *)malloc(sizeof(struct node)); for (i=1;i<=6;i++) cin>>(*p1).data[i]; p1->pre=NULL; while((*p1).data[1][0]!='e') { p2=(struct node *)malloc(sizeof(struct node)); p2->pre=p1; for (i=1;i<=6;i++) cin>>(*p2).data[i]; p1=p2; } p1=p1->pre; while(p1->pre) { for (i=1;i<=5;i++) cout<<(*p1).data[i]<<' '; cout<<(*p1).data[6]<<endl; p1=p1->pre; } for (i=1;i<=5;i++) cout<<(*p1).data[i]<<' '; cout<<(*p1).data[6]; }
31
15,401
struct student { char number[20]; char name[20]; char sex; int age; float score; char address[20]; struct student *next; } main() { int i,j,m,n=0; struct student *head,*p1,*p2,*p; p1=p2=(struct student *)malloc(LEN); for(i=0;;i++) { scanf("%s",p1->number); if(strcmp(p1->number,"end")==0) { break; } else { scanf("%s%*c%c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address); n+=1; } if(i==0) { head=p1; } else { p2->next=p1; } p2=p1; p1=(struct student *)malloc(LEN); } p2->next=NULL; m=n; for(i=0;i<n;i++) { p=head; for(j=0;j<m-1;j++) { p=p->next; } printf("%s %s %c %d %g %s\n",p->number,p->name,p->sex,p->age,p->score,p->address); m-=1; } }
31
15,402
void main() { struct s { char a[100]; char b[100]; char c; int d; float e; char f[100]; struct s *next; }; struct s *p1,*p2,*head; int i,j,k,m,n,t; p1=p2=(struct s *)malloc(sizeof(struct s)); head=p1=p2;n=1; scanf("%s %s %c %d %f %s",p1->a,p1->b,&p1->c,&p1->d,&p1->e,p1->f); for(i=0;i<10000;i++) { p1=(struct s *)malloc(sizeof(struct s)); p2->next=p1; p2=p1; scanf("%s",p1->a); if(strcmp(p1->a,"end")!=0) { scanf("%s %c %d %f %s",p1->b,&p1->c,&p1->d,&p1->e,p1->f); n++; } else break; } p1=p2=head; for(j=0;j<n-1;j++) { for(i=0;i<n-j-1;i++) p1=p1->next; printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f); p1=head; } printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f); }
31
15,403
int n=1; struct student {char num[20]; char name[20]; char sex; int age; char score[10]; char ad[20]; struct student *next; }; struct student* appendnewnode(void) { struct student *newnode,*thisnode; int x; do{ newnode=(struct student*)malloc(sizeof(struct student)); scanf("%s",newnode->num); getchar(); x=strcmp(newnode->num,"end"); if(x!=0){ scanf("%s %c %d %s %s",newnode->name ,&newnode->sex ,&newnode->age ,newnode->score ,newnode->ad); if(n==1) { newnode->next =0; } else { newnode->next =thisnode; } thisnode=newnode; n++; } }while(x!=0); return(thisnode); } void main() { struct student *p,*head; head=appendnewnode(); p=head; do { printf("%s %s %c %d %s %s\n",p->num ,p->name ,p->sex ,p->age ,p->score ,p->ad); p=p->next ; }while(p!=NULL); }
31
15,404
struct seqs//???? { char num[10]; char name[20]; char sex; int age; float score;//??????? char addr[100]; struct seqs *next; }; struct seqs *build()//???? { struct seqs *head,*newnode,*p; newnode=(struct seqs *)malloc(len); newnode->next=NULL;//???????? scanf("%s %s %c %d %f %s",newnode->num,newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->addr);//???????????? p=newnode;//???p????????? while(1)//??????????????????? { newnode=(struct seqs *)malloc(len);//????? scanf("%s",newnode->num); if(newnode->num[0]=='e') break;//??????????? scanf("%s %c %d %f %s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->addr);//???? newnode->next=p;//?????????? p=newnode;//???p?????? } head=p;//??head return head; } void main() { int i; struct seqs *p; p=build(); while(p!=NULL) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr); p=p->next; } }
31
15,405
struct st { char id[20]; char name[20]; char sex; int age; float goal; char address[20]; struct st *last; }; struct st *input(void) { int n; struct st *end,*p1,*p2; n=0; p1=p2=(struct st *)malloc(sizeof(struct st)); scanf("%s",p1->id); while(strcmp(p1->id,"end")!=0) { scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->goal,p1->address); if(n==0) p1->last=NULL; else p1->last=p2; p2=p1; p1=(struct st *)malloc(sizeof(struct st)); scanf("%s",p1->id); n=1; } end=p2; return(end); } void output(struct st *end) { struct st *p; p=end; if(end!=NULL) do { printf("%s %s %c %d ",p->id,p->name,p->sex,p->age); if(floor(p->goal)==p->goal) printf("%.0f",p->goal); else printf("%.1f",p->goal); printf(" %s\n",p->address); p=p->last; }while(p!=NULL); } int main() { struct st *end; end=input(); output(end); }
31
15,406
struct student { char num[20]; char name[20]; char sex[2]; char age[20]; char score[10]; char add[20]; struct student *next; }*head,*p; void input() { head=NULL; int n=0; do { p=(struct student *)malloc(LEN); scanf("%s",p->num); if(p->num[0]=='e') break; scanf("%s%s%s%s%s",p->name,p->sex,&p->age,&p->score,p->add); n++; if(n==1) p->next=NULL; else p->next=head; head=p; }while(1); p=head; } void output() { if(head!=NULL) { do { printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; }while(p!=NULL); } } void main() { input(); output(); }
31
15,407
struct stu { char num[20]; char name[20]; char sex; int age; double x; char add[20]; struct stu *next; }; struct stu *creat() { struct stu *head,*p1,*p2; p1=(struct stu *)malloc(LEN); scanf("%s %s %c %d %lf %s ",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->x,&p1->add); p2=p1;head=p1; p1->next=NULL; while(1) { p1=(struct stu *)malloc(LEN); scanf("%s ",&p1->num); if(p1->num[0]!='e') { scanf("%s %c %d %lf %s ",&p1->name,&p1->sex,&p1->age,&p1->x,&p1->add); p1->next=p2; p2=p1; } else break; } return p2; } void print(struct stu *head) { struct stu *p; p=head; while(p!=NULL) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->x,p->add); p=p->next; } } void destroy(struct stu *head) { struct stu *p; while(head) { p=head; head=head->next; free(p); } } int main() { struct stu *head; head=creat(); print(head); destroy(head); return 0; }
31
15,408
/*°ü?0?8¨?0?6?0?0?0?0?0?7?0?4?0?4?0?5?0?1?0?1?0?7?0?6?0?3?0?4?0?4?0?9?0?4?0?8?0?5?0?6?0?3?0?0?0?2?0?5§?0?7ú?0?8?0?2?0?4?0?3?0?3?0?4?0?5?0?1?0?6?0?4?0?5?0?2 00630018 zhouyan m 20 10.0 28#460 ?0?8?0?1?0?6?0?5?0?8?0?2×?0?6?0?2ó?0?6?0?8"end"?0?5á?0?8?0?3 ?0?1?0?1?0?7?0?3?0?8?0?1?0?6?0?2 ?0?5?0?0?0?8?0?1?0?6?0?5?0?8?0?2?0?2?0?3?0?6?0?6°?0?7?0?9?0?9 ?0?5§?0?2?0?3 ?0?4?0?9?0?1?0?4 ?0?4?0?8±?0?8 ?0?2ê?0?9?0?1 ?0?8?0?1·?0?0 ?0?8?0?1?0?0· ?0?8?0?2?0?0?0?9?0?8?0?5?0?8?0?1?0?4ò?0?8?0?1?0?6?0?2 */ struct student { char info[100]; struct student *pre; }; struct student *creat() { struct student *head,*p1,*p2; head=(struct student *)malloc(sizeof(struct student)); p1=head; head->pre=0; while(1) { gets(p1->info); if(p1->info[0]=='e') { return p1->pre; } else { p2=(struct student *)malloc(sizeof(struct student)); p2->pre=p1; p1=p2; } } } int main() { struct student *p; p=creat(); while(p!=0) { printf("%s\n",p->info); p=p->pre; } return 0; } /*00630018 zhouyan m 20 10 28#4600 0063001 zhouyn f 21 100 28#460000 0063008 zhoyan f 20 1000 28#460000 0063018 zhouan m 21 10000 28#4600000 00613018 zhuyan m 20 100 28#4600 00160018 zouyan f 21 100 28#4600 01030018 houyan m 20 10 28#4600 0630018 zuyan m 21 100 28#4600 10630018 zouan m 20 10 28#46000 end 10630018 zouan m 20 10 28#46000 0630018 zuyan m 21 100 28#4600 01030018 houyan m 20 10 28#4600 00160018 zouyan f 21 100 28#4600 00613018 zhuyan m 20 100 28#4600 0063018 zhouan m 21 10000 28#4600000 0063008 zhoyan f 20 1000 28#460000 0063001 zhouyn f 21 100 28#460000 Press any key to continue*/
31
15,409
void main() { struct student { char a[100]; struct student * next; }; struct student * head; struct student * p1,* p2; p1=p2=(struct student * )malloc(LEN); gets(p1->a); p1->next=0; while(strcmp(p1->a,"end")) { head=p1; p2=p1; p1=(struct student * )malloc(LEN); gets(p1->a); p1->next=p2; } for(p1=head;p1!=0;p1=p1->next) printf("%s\n",p1->a); }
31
15,410
struct stu { struct stu *next; char a[100]; }; void print(struct stu*p,int n) { if(n>0) { printf("%s",p->a); printf("\n"); print(p->next,n-1); } } int main() { int n=1,i,m=100000; struct stu *p1,*p2; p1=(struct stu*)malloc(LEN); gets(p1->a); for(i=0;i<m;i++) { p2=(struct stu*)malloc(LEN); gets(p2->a); if(p2->a[0]!='e'&&p2->a[1]!='n'&&p2->a[2]!='d') { p2->next=p1; p1=p2; n+=1; } else { p2->next=p1; break; } } print(p2->next,n); return 0; }
31
15,411
struct student{ char num[20]; char name[20]; char sex; int old; float score; char add[15]; struct student *next; }; int main() { struct student *p1,*p2; p1=(struct student *)malloc(len); p1->next=NULL; scanf("%s",p1->num); while(strcmp(p1->num,"end")!=0){ scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->old,&p1->score,p1->add); p2=p1; p1=(struct student *)malloc(len); p1->next=p2; scanf("%s",p1->num); } while(p1->next!=NULL){ p1=p1->next; printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->old,p1->score,p1->add); } return 0; }
31
15,412
struct student { char num[200],name[80],sex[20],age[30],score[30],add[200]; struct student *next; }; struct student *creat() {struct student *head,*p1,*p2; p1=(struct student*)malloc(LEN); scanf("%s",p1->num); p1->next=0; while(strcmp(p1->num,"end")!=0) { p2=p1; scanf("%s%s%s%s%s\n",p1->name,p1->sex,p1->age,p1->score,p1->add); p1=(struct student*)malloc(LEN); p1->next=p2; scanf("%s",p1->num); } head=p2; return head; } void print (struct student* head) { struct student *p; for(p=head;p!=0;p=p->next) { printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); } } int main() { struct student* head; head=creat(); print(head); return 7; }
31
15,413
struct student { char num[20]; char name[20]; char sex[2]; int age; float score; char add[50]; struct student*next; }; int n; struct student*creat(void) { int juge=1; struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student*)malloc(LEN); scanf("%s",p1->num); scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add); head=NULL; while(1) { head=p1; n=n+1; if(n==1) p1->next=NULL; if(n>1) { p1->next=p2; p2=p1; head=p1; } p1=(struct student*)malloc(LEN); scanf("%s",p1->num); juge=strcmp(p1->num,"end"); if(juge==0)break; scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add); } return(head); } void print(struct student*head) { struct student*p; p=head; if(head!=NULL) while(p!=NULL) { printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; } } void main() { struct student *p; p=creat(); print(p); }
31
15,414
struct student { struct student *pre; char num[100]; char name[20]; char sex[2]; char age[10]; char score[10]; char ad[100]; }; void main() { int n=0; struct student *end,*p1,*p2,*p; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); while(strcmp(p1->num,"end")!=0) { scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->ad); n=n+1; if(n==1) p1->pre=NULL; else p1->pre=p2; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); } p=p2; do { printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad); p=p->pre; }while(p!=NULL); }
31
15,415
int n; struct student { char num[10]; char name[20]; char sex[2]; int year; int score[10]; char add[10]; struct student *next; }; struct student *creat() { struct student *head,*p1,*p2; p1=(struct student*)malloc(LEN); scanf("%s %s %s %d %s %s",p1->num,p1->name,p1->sex,&p1->year,p1->score,p1->add); p1->next=NULL; n=1; head=p1; p2=p1; do { p1=(struct student*)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0)break; scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->year,p1->score,p1->add); p1->next=NULL; p2->next=p1; p2=p1; n=n+1; }while(1); return(head); } void main() { struct student *head,*p,*q; head=creat(); while(n!=0) { for(p=head;p->next!=NULL;) { q=p; p=p->next; } printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add); n=n-1; q->next=NULL; } }
31
15,416
struct node; struct node { char id[len]; char name[len]; char sexual[len]; char age[len]; char score[len]; char addr[len]; struct node* next; struct node* pre; }; char end[len]="end"; int main(){ struct node* p; p=(struct node*)malloc(sizeof(struct node)); p->pre=NULL; while(1){ scanf("%s",p->id); if(strcmp(p->id,end)==0) break; scanf("%s%s%s%s%s",p->name,p->sexual,p->age,p->score,p->addr); p->next = (struct node*) malloc(sizeof(struct node)); p->next->pre = p; p=p->next; } p=p->pre; free(p->next); while(p!=NULL){ printf("%s %s %s %s %s %s\n",p->id,p->name,p->sexual,p->age,p->score,p->addr); p=p->pre; if(p!=NULL) free(p->next); } return 0; }
31
15,417
struct student { char id[1000]; struct student *pre,*next; }; void main() { struct student *p1,*p2,*head1,*head2; int n=0; char temp[1000]; p1=p2=NULL; while(gets(temp),strcmp(temp,"end")!=0) { n=n+1; p1=(struct student *)malloc(sizeof(struct student)); p1->pre=NULL; p1->next=NULL; head1=NULL; strcpy(p1->id,temp); if(n==1)head1=p1;else {p2->next=p1;p1->pre=p2;} p2=p1; } head2=p2; while(p2!=NULL) { printf("%s\n",p2->id); p2=p2->pre; } }
31
15,418
struct Inform { char number[30]; char name[30]; char gender[2]; char age[4]; char score[10]; char address[20]; struct Inform *next; }; int n; struct Inform *creat() { struct Inform *head; struct Inform *p1,*p2; head=NULL; p1=p2=(struct Inform*)malloc(LEN); n=0; scanf("%s%s%s%s%s%s",&p1->number,&p1->name,&p1->gender,&p1->age,&p1->score,&p1->address); while(strcmp(p1->number,"end")!=0) { n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct Inform*)malloc(LEN); scanf("%s",&p1->number); if(strcmp(p1->number,"end")!=0) scanf("%s%s%s%s%s",&p1->name,&p1->gender,&p1->age,&p1->score,&p1->address); } p2->next=NULL; return head; } void print(struct Inform *h) { struct Inform *p; p=h; while(p!=NULL) { printf("%s %s %s %s %s %s\n",p->number,p->name,p->gender,p->age,p->score,p->address); p=p->next; } } struct Inform *invert(struct Inform *h) { struct Inform *p=h->next; struct Inform *q=p->next; h->next=NULL; while(q!=NULL) {p->next=h;h=p;p=q;q=q->next;p->next=h; } p->next=h; return p; } int main() { void print(struct Inform *h); struct Inform *invert(struct Inform *h); struct Inform *hea; hea=creat(); hea=invert(hea); print(hea); return 0; }
31
15,419
struct Student { char num[10]; char nam[20]; char sex[2]; char age[3]; char sco[6]; char add[12]; struct Student*next; }; int n; struct Student*creat(void) { struct Student*head; struct Student*p; p=(struct Student*)malloc(LEN); head=NULL;n=0; scanf("%s",p->num); while(strcmp(p->num,"end")!=0) { n=n+1; scanf("%s%s%s%s%s",p->nam,p->sex,p->age,p->sco,p->add); if(n==1)head=p; else { p->next=head; head=p; } p=(struct Student*)malloc(LEN); scanf("%s",p->num); } return(head); } int main() { struct Student*pt; pt=creat(); while(pt!=NULL) { printf("%s %s %s %s %s %s\n",pt->num,pt->nam,pt->sex,pt->age,pt->sco,pt->add); pt=pt->next; } return 0; }
31
15,420
int main() { struct student { char No[9]; char name[20]; char sex; int age; char score[8]; char add[20]; struct student *next,*last; }; struct student *p,*head,*tail; p=(struct student*)malloc(sizeof(struct student)); head=p; head->last=NULL; do { scanf("%s",p->No); if(p->No[0]=='e') { p->next=NULL; tail=p->last; } else { scanf("%s %c%d%s%s",p->name,&p->sex,&p->age,&p->score,p->add); p->next=(struct student*)malloc(sizeof(struct student)); p->next->last=p; } p=p->next; }while(p!=NULL); p=tail; while(p!=NULL) { printf("%s %s %c %d %s %s\n",p->No,p->name,p->sex,p->age,p->score,p->add); p=p->last; } return 0; }
31
15,421
struct student { char num[10],name[50],addr[50],score[10],sex; int age; struct student *before; }; void main() { struct student *p1=0,*p2; p2=(struct student *)malloc(len); while(scanf("%s %s %c %d %s %s",p2->num,p2->name,&(p2->sex),&(p2->age),p2->score,p2->addr)!=EOF) { if(p2->num[0]=='e') break; p2->before=p1; p1=p2; //printf("%s %s %c %d %d %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->addr); p2=(struct student *)malloc(len); } p2=p1; while(p2!=0) { printf("%s %s %c %d %s %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->addr); p2=p2->before; } getchar(); getchar(); }
31
15,422
struct student { char ID[20]; char name[20]; char sex; int age; char score[20]; char address[20]; struct student *next; }; struct student *create() { struct student *head,*p1,*p2; p1=(struct student*)malloc(LEN); scanf("%s",p1->ID); if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;} else { head=p1; scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); p1->next=NULL; p2=p1; do { p1=(struct student*)malloc(LEN); p1->next=NULL; scanf("%s",p1->ID); if(strcmp(p1->ID,"end")==0){p2->next=NULL;free(p1);break;} else { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); p2->next=p1; p1->next=NULL; p2=p1; } }while(1); } return(head); } struct student *fanxu(struct student *head) { struct student *prep,*nowp,*nextp; prep=NULL; nowp=head; while(nowp) { nextp=nowp->next; nowp->next=prep; prep=nowp; nowp=nextp; } return prep; } void print(struct student *head) { struct student *p; p=head; while(p) { printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address); p=p->next; } } int main() { struct student *head; head=create(); head=fanxu(head); print(head); }
31
15,423
struct student { char str[50]; struct student *next; }; int n; struct student *creat() { struct student *head, *temp, *end; head = end = temp = (struct student*) malloc(LEN); gets(temp->str); while (temp->str[0] != 'e') { temp->next = head; head = temp; temp = (struct student*) malloc(LEN); gets(temp->str); } end->next = NULL; return (head); } void print(struct student *head) { struct student *p; p = head; while (p != NULL) { puts(p->str); p = p->next; } } void main() { struct student *head; head = creat(); print(head); }
31
15,424
struct student { char num[20]; char name[20]; char sex; int age; float score; char add[20]; struct student * next; }; struct student * input(void) { struct student *p1,*p2,*head; p1=(struct student *)malloc(len); p1->next=NULL; scanf("%s %s %c %d %f %s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add); do { p2=(struct student *)malloc(len); scanf("%s %s %c %d %f %s",p2->num,p2->name,&p2->sex,&p2->age,&p2->score,p2->add); p2->next=p1; p1=p2; }while(strcmp(p2->num,"end")!=0); head=p2->next; return(head); } void print(struct student*head) { struct student *p; p=head; do { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; } while(p!=NULL); } void main() { struct student * head; head=input(); print(head); }
31
15,425
struct student { char num[100]; struct student *next; }; main() { int n,i; struct student *head,*p1,*p2,*p; n=0;p1=p2=(struct student*) malloc(LEN); gets(p1->num); head=NULL; while(strcmp(p1->num,"end")!=0) { n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student*) malloc(LEN); gets(p1->num); } p2->next=NULL; for(i=0;i<n;i++) { p=head; while(p->next!=NULL) { p1=p; p=p->next; } printf("%s\n",p->num); p1->next=NULL; } }
31
15,426
main() { char s[1000][1000]; int i=0,n=0; while(1) { gets(s[n]); if(s[n][0]=='e') break; else n++; } for(i=n-1;i>=0;i--) {puts(s[i]);printf("\n");} }
31
15,427
struct student { char num[10]; char name[20]; char sex[5]; int age; char score[20]; char addr[20]; struct student *next; }; struct student *head; struct student *input() { struct student *p1,*p2; p1=p2=(struct student *)malloc(sizeof(struct student)); scanf("%s",p1->num); p2->next=NULL; while(strcmp(p1->num,"end")!=0) { scanf("%s",p1->name); scanf("%s",p1->sex); scanf("%d",&p1->age); scanf("%s",p1->score); scanf("%s",p1->addr); p1=(struct student *)malloc(sizeof(struct student)); scanf("%s",p1->num); p1->next=p2; p2=p1; } head=p1; return(head); } void print(struct student *head) { struct student *p; p=head->next; if(head!=NULL) do { printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr); p=p->next; } while(p!=NULL); } main() { input(); print(head); return 0; }
31
15,428
struct Student { char stu[500]; struct Student * next; }; int n=0; void main() { struct Student * creat(); void print(struct Student *head,int num); struct Student *head; head=creat(); int i=0; for(i=n;i>0;i--) print(head,i); } struct Student * creat() { struct Student *p1,*p2; struct Student *head; head=NULL; p1=p2=(struct Student *)malloc(LEN); gets(p1->stu); while(strcmp(p1->stu,"end")!=0) { n=n+1; if(n==1) { head=p1; } else { p2->next=p1; } p2=p1; p1=(struct Student *)malloc(LEN); gets(p1->stu); } p2->next=NULL; return(head); } void print(struct Student *head,int num) { struct Student *p; p=head; int count=1; while(count<num) { p=p->next; count+=1; } printf("%s\n",p->stu); }
31
15,429
struct student { char info[100]; struct student *next; struct student *former;}; int i,j,k,n; void main() { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(len); gets(p1->info); head=0; while(strcmp(p1->info,"end")!=0) { n=n+1; if(n==1) {head=p1; p1->former=0;} else {p2->next=p1; p1->former=p2;} p2=p1; p1=(struct student *)malloc(len); gets(p1->info); } p2->next=0; p1=p2; do{ puts(p2->info); printf("\n"); p2=p2->former;} while(p2!=0); }
31
15,430
void main() { char s[1000][100]; int i=0,k; gets(s[0]); while(s[i][0]!='e') { i=i+1; gets(s[i]); } for(k=i-1;k>=0;k--) { puts(s[k]); } }
31
15,431
struct student//?? ?? ?? ?? ?? ?? { char num[12]; char name[20]; char sex; int age; float grade; char add[12]; struct student *next; }; int n=1; struct student *build(void) //???? { struct student *pn, *pt; pn=(struct student*)malloc(sizeof(struct student)); scanf("%s",pn->num); pn->next=NULL; while(pn->num[0]!='e') { scanf(" %s %c %d %f %s",&pn->name,&pn->sex,&pn->age,&pn->grade,&pn->add); pt=pn; pn=(struct student*)malloc(sizeof(struct student)); pn->next=pt; scanf("%s",pn->num); } return (pt); } void main() { struct student *p; p=build(); while(p!=NULL) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add); p=p->next; } }
31
15,432
struct student{ char num[10]; char name[20]; char gd; int age; float sc; char adr[10]; struct student *next; }; struct student *append() { struct student *head,*p1,*p2=NULL; while(1) { p1=(struct student*)malloc(sizeof(struct student)); scanf("%s",p1->num); if (p1->num[0]=='e') { head=p2; break; } else { scanf("%s %c %d%f %s",p1->name,&p1->gd,&p1->age,&p1->sc,p1->adr); p1->next=p2; p2=p1; } } return head; } void main() { struct student *p; p=append(); for(;p!=NULL;p=p->next) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->gd,p->age,p->sc,p->adr); } }
31
15,433
struct student { char num[20]; char name[20]; char sex; int age; double score; char address[20]; struct student *next; struct student *former; }; main() { struct student *p,*p1,*p2,*header; header=(struct student *)malloc(sizeof(struct student)); header->next=header->former=NULL; p2=header; for(;;) { p1=(struct student *)malloc(sizeof(struct student)); p2->next=p1; p1->former=p2; scanf("%s",p1->num); if(p1->num[0]=='e'&&p1->num[1]=='n'&&p1->num[2]=='d') break; scanf("%s %c %d %lf %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address); p2=p1; } p2->next=NULL; free(p1); p=p2; for(;p->former!=NULL;) { if(p->score==(int)(p->score)) printf("%s %s %c %d %d %s\n",p->num,p->name,p->sex,p->age,(int)(p->score),p->address); else printf("%s %s %c %d %.1lf %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); p=p->former; } p1=p2; for(;p1->former!=NULL;) { p2=p1; p1=p2->former; free(p2); } free(p1); }
31
15,434
struct student { char num[20]; char name[20]; char ch[1]; int ye;char gra[10];char add[20]; struct student *next; }; int main() { struct student *p,*p1,*p2; int n; p1=p2=(struct student*) malloc(LEN); scanf("%s",&p1->num); p=NULL;n=0; while (p1->num[0]!='e') { scanf("%s%s%d%s%s",&p1->name,&p1->ch,&p1->ye,&p1->gra,&p1->add); n++;if (n==1) p2=p1; else p1->next=p2; p=p1;p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",&p1->num); } if (p!=NULL) do { printf("%s %s %s %d %s %s\n",p->num,p->name,p->ch,p->ye,p->gra,p->add); p=p->next; }while (p!=NULL); }
31
15,435
struct stu { char information[100];//???????????????????????????? struct stu*next;//?????? struct stu*last;//?????????????????????????? }; struct stu*creat(void) { struct stu *end,*p1,*p2; int flag=1; p1=(struct stu*)malloc(Len); gets(p1->information); if(strcmp(p1->information,"end")==0) //?????????????? { p2=null; flag=0;} else { p1->last=null;//????????????? do { p2=p1; p1=(struct stu*)malloc(Len); p2->next=p1; //???????????? p1->last=p2;//????????????????? gets(p1->information); if(strcmp(p1->information,"end")==0) flag=0;//??‘end’??????? }while(flag==1); } end=p2; return end; } void printf(struct stu*end) { struct stu* p; p=end; while(p!=null) { printf("%s\n",p->information); p=p->last;//??????????? } } int main() { struct stu *move; move=creat(); printf(move); }
31
15,436
struct Student{ char stu[100]; struct Student *next; }; int main() { struct Student *p,*head,*p1,*p2; int n = 0; p2 = p1 = (struct Student *)malloc(Len); head = NULL; gets(p1->stu); while(strcmp(p1->stu,"end")!=0){ n++; head = p1; if (n==1) p1->next = NULL; else{ p1->next = p2; p2 = p1; } p1 = (struct Student *)malloc(Len); gets(p1->stu); } p = head; if (head != NULL){ do{ puts(p->stu); p=p->next; }while(p != NULL); } return 0; }
31
15,437
struct student { char str[500]; struct student *next; struct student *before; }; struct student *creat(void) { struct student *head,*p1,*p2; p1=p2=(struct student*)malloc(LEN); gets(p1->str); p1->before=NULL; head=p1; while(strcmp(p1->str,"end")!=0){ p2=p1; p1=(struct student*)malloc(LEN); gets(p1->str); p2->next=p1; p1->before=p2; } p2->next=NULL; head=p2; return(head); } void main() { struct student *p,*head; head=creat(); p=head; while(p->before!=NULL) {printf("%s\n",p->str); p=p->before; } printf("%s",p->str); }
31
15,438
struct stu { char num[20],name[20],add[30],sex; int age; float score; struct stu *next; } main() { struct stu *p1,*p2; p1=(struct stu*)malloc(len); p1->next=NULL; while(1) { scanf("%s",p1->num); if(!strcmp(p1->num,"end")) break; scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->add); p2=(struct stu*)malloc(len); p2->next=p1; p1=p2; } p1=p1->next; while(p1) { printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->next; } }
31
15,439
struct student{ struct student *pre; char No[10]; char name[20]; char sex; int age; float grade; char address[20]; struct student *next; }; struct student *create(){ struct student *head,*p1,*p2,*h,*p; p1=(struct student *)malloc(sizeof(struct student)); scanf("%s",p1->No); if(p1->No[0]=='e'){ free(p1); head=NULL; return head; } else{ scanf("%s",p1->name); getchar(); scanf("%c",&p1->sex); scanf("%d",&p1->age); scanf("%f",&p1->grade); scanf("%s",p1->address); p1->next=NULL; } head=p1; p2=p1; for(;;){ p1=(struct student *)malloc(sizeof(struct student)); scanf("%s",p1->No); if(p1->No[0]=='e'){ head->pre=NULL; for(h=head;h->next!=NULL;){ p=h->next; p->pre=h; h=h->next; } free(p1); return head; } else{ scanf("%s",p1->name); getchar(); scanf("%c",&p1->sex); scanf("%d",&p1->age); scanf("%f",&p1->grade); scanf("%s",p1->address); p1->next=NULL; } p2->next=p1; p2=p1; } } void destroy(struct student *head){ struct student *p; for(;head!=NULL;){ p=head; head=head->next; free(p); } } void main() { struct student *h,*t,*h1; h=create(); for(h1=h;h1->next!=NULL;){ h1=h1->next; } for(t=h1;t!=NULL;t=t->pre){ printf("%s %s %c %d %g %s\n",t->No,t->name,t->sex,t->age,t->grade,t->address); } destroy(h); }
31
15,440
struct stu {char id[100]; char name[100]; char sex[3]; char age[10]; char score[10]; char add[100]; struct stu *next; }; int main() { int k,m,n,t,ans,ii,i,j,jj,flag; struct stu *p0,*p1,*p2,*head; char s[30]; p1 = (struct stu*)malloc(LEN); scanf("%s%s%s%s%s%s",p1->id,p1->name,p1->sex,&p1->age,&p1->score,p1->add); p1->next = NULL; head = p1; p2 = p1; while (1) { p1 = (struct stu*)malloc(LEN); scanf("%s",p1->id); if (strcmp(p1->id,"end")==0) { head = p2; break; } scanf("%s%s%s%s%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add); p1->next = p2; p2 = p1; } p1 = head; while (p1->next!=NULL) { printf("%s %s %s %s %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->add); p1 = p1->next; } printf("%s %s %s %s %s %s",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->add); return 0; }
31
15,441
struct node { char str[100]; struct node *next; }; void main() { struct node *head=NULL, *element; char str[100]; gets(str); while(strcmp(str,"end")) { element=(struct node *)malloc(sizeof(struct node)); strcpy(element->str,str); element->next=head; head=element; gets(str); } while(head!=NULL) { puts(head->str); head=head->next; } }
31
15,442
int main() { struct student { char a[100]; struct student *back; }; int n; struct student *p1,*p2,*end; p1=p2=(struct student *)malloc(sizeof(struct student)); gets(p1->a); p1->back=0; for (n=1;;n++) { p1=(struct student * )malloc(sizeof(struct student)); p1->back=p2; p2=p1; gets(p1->a); if (p1->a[0]=='e') { end=p1->back; break; } } struct student *p; p=end; for (n=1;;n++) { printf("%s\n",p->a); p=p->back; if (p==0)break; } return 0; }
31
15,443
struct STUDENT { char student[100]; struct STUDENT* former; }; int main() { struct STUDENT* p1 = (struct STUDENT*) malloc(sizeof(struct STUDENT)); struct STUDENT* p2; p1->former = NULL; for (gets(p1->student);p1->student[0]!='e'; gets(p1->student)) { p2 = p1; p1 = (struct STUDENT*) malloc(sizeof(struct STUDENT)); p1->former = p2; } for (p1=p1->former; p1!=NULL; p1=p1->former) { printf("%s\n", p1->student); } return 0; }
31
15,444
main() { struct h {char mun[10]; char name[20]; char sex; int age; float score; char add[20]; struct h *p; } ; struct h *a,*b; a=len; a->p=NULL; int i; for(i=0;i<1000;i++) {scanf("%s",a->mun); if(!strcmp(a->mun,"end")) break; scanf("%s %c %d %f %s",a->name,&a->sex,&a->age,&a->score,a->add); b=len; b->p=a; a=b;} a=a->p; while(a) { printf("%s %s %c %d %g %s\n",a->mun,a->name,a->sex,a->age,a->score,a->add); a=a->p; } }
31
15,445
struct stu { char num[20]; char name[20]; char s; int age; char point[10]; char adr[50]; struct stu *p; }; void main() { struct stu *stu1=NULL; int n=sizeof(struct stu); stu1=(struct stu *) malloc(n); struct stu *head=NULL,*curent=NULL; stu1->p=NULL; while(scanf("%s",stu1->num)) { if((strcmp(stu1->num,"end"))==0) break; scanf("%s %c %d %s %s",stu1->name,&stu1->s,&stu1->age,&stu1->point,stu1->adr); stu1->p=curent; curent=stu1; stu1=(struct stu*) malloc(n); } while(curent!=NULL) { printf("%s %s %c %d %s %s\n",curent->num,curent->name,curent->s,curent->age,curent->point,curent->adr); curent=curent->p; } }
31
15,446
struct a { char id[150]; struct a *pre; }; struct a *creat(){ struct a *head, *p1, *p2; p1=(struct a*)malloc(l); gets(p1->id); p1->pre=NULL; p2=p1; while(1){ p1=(struct a*)malloc(l); gets(p1->id); if (p1->id[0]=='e'){break;} p1->pre=p2; p2=p1; } free(p1); head=p2; return head; } void des(struct a *head){ struct a *p; while(head){ p=head; head=head->pre; free(p); } } int main (){ struct a *head, *p; head=creat(); p=head; while(p){ printf("%s\n", p->id); p=p->pre; } des(head); return 0; }
31
15,447
void main() { int n; struct student { char num[50]; char name[100]; char sex; int age; char score[20]; char add[100]; struct student *before; }*thisNode,*newNode; for(n=1;;n++) { newNode=(struct student *)malloc(sizeof(struct student)); if(newNode==NULL) { printf("error!"); exit(-1); } scanf("%s",newNode->num); if(n==1) newNode->before=NULL; else newNode->before=thisNode; if(newNode->num[0]=='e') break; scanf("%s %c %d %s %s",newNode->name,&newNode->sex, &newNode->age,newNode->score,newNode->add); thisNode=newNode; } for(;;) { printf("%s %s %c %d %s %s\n",thisNode->num,thisNode->name,thisNode->sex, thisNode->age,thisNode->score,thisNode->add); if(thisNode->before==NULL) break; thisNode=thisNode->before; } }
31
15,448
struct stu {char num[20]; char name[20]; char sex; int age; char score[10]; char add[20]; struct stu *next;}; void main() { struct stu *p1,*p2; int n=0; p1=p2=(struct stu*)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) {n=-1;p2=NULL;} else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); while(n>=0) {n+=1; if(n==1)p1->next=NULL; else p1->next=p2; p2=p1; p1=(struct stu*)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0)break; scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);} while(p2!=NULL) {printf(A,p2->num,p2->name,p2->sex,p2->age,p2->score,p2->add); p2=p2->next;} }
31
15,449
struct student { char num[20]; char name[20]; char sex[5]; char age[5]; char score[10]; char address[20]; struct student *next; }; int main() { struct student *head,*p1,*p2,*end; char c; int i1,n1; p1=p2=(struct student*)malloc(sizeof(struct student)); scanf("%s%s%s%s%s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score); i1=0; while((c=getchar())!='\n') { p1->address[i1]=c; i1++; } for(;i1<=19;i1++) p1->address[i1]='\0'; head=p1; n1=0; while(p1->num[0]!='e') { n1=n1+1; p2=p1; p1=(struct student*)malloc(sizeof(struct student)); scanf("%s",&p1->num); if(p1->num[0]=='e') break; scanf("%s%s%s%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->score); i1=0; while((c=getchar())!='\n') { p1->address[i1]=c; i1++; } for(;i1<=19;i1++) p1->address[i1]='\0'; if(n1==1) p1->next=head; else p1->next=p2; } end=p2;//input p1=end; i1=0; while(p1!=head) { printf("%s %s %s %s %s%s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address); p1=p1->next; } printf("%s %s %s %s %s%s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address); }
31
15,450
int l; struct students { char num[10]; char name[20]; char sex; int age; float score; char addr[100]; struct students *next; }; struct students *ann() { struct students *head=NULL,*newnode,*p; int i; for(i=0;;i++) { newnode=(struct students *)malloc(sizeof(struct students)); scanf("%s",newnode->num); if(newnode->num[0]=='e') { l=i; head=p; break; } scanf("%s %c %d %f %s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->addr); if(i==0) { newnode->next=NULL; p=newnode; } else { newnode->next=p; p=newnode; } } return(head); } void main() { int i; struct students *p; p=ann(); for(i=0;i<l;i++) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr); p=p->next; } }
31
15,451
struct student { char num[30]; char name[30]; char s[2]; int age; float score; char add[30]; struct student *next; }; struct student *creat() { int n=0; struct student *head; struct student *p1; struct student *p2; p1=p2=(struct student *)malloc(LEN); scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->s,&p1->age,&p1->score,p1->add); p2->next=0; while(p1->num[0]!='e') { n=n+1; if(n>1) p1->next=p2; p2=p1;head=p1; p1=(struct student *)malloc(LEN); scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->s,&p1->age,&p1->score,p1->add); } return(head); } int main() { struct student *p=creat(); for(;;) { printf("%s %s %s %d %g %s\n",p->num,p->name,p->s,p->age,p->score,p->add); p=p->next; if(p==0)break; } }
31
15,452
int main() { struct student { char imfor[100]; struct student *early; }; int m; struct student *p1,*p2,*last,*p; p1=p2=(struct student *)malloc(sizeof(struct student)); gets(p1->imfor); p1->early=0; for (m=1;m<1000;m++) { p1=(struct student * )malloc(sizeof(struct student)); p1->early=p2; p2=p1; gets(p1->imfor); if (p1->imfor[0]=='e') { last=p1->early; break; } } p=last; for (m=1;m<1000;m++) { printf("%s\n",p->imfor); p=p->early; if (p==0) { break; } } }
31
15,453
struct student { char num[10]; char name[20]; char sex; int age; char score[10]; char add[20]; struct student *next; }; struct student *creat(void) { struct student *head,*p1,*p2; p1=p2=(struct student *)malloc(LEN); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add); head=p1; loop: p1=(struct student *)malloc(LEN); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add); if(strcmp(p1->num,"end")!=0) { p2->next=p1; p2=p1; goto loop; } else p2->next=NULL; return(head); } struct student *reverse(struct student *head) { struct student *nowp,*prep,*nextp; prep=NULL; nowp=head; while(nowp!=NULL) { nextp=nowp->next; nowp->next=prep; prep=nowp; nowp=nextp; } return(prep); } int main() { struct student *head,*head1; head=creat(); head1=reverse(head); struct student *pt1; pt1=head1; while(pt1!=NULL) { printf("%s %s %c %d %s %s\n",pt1->num,pt1->name,pt1->sex,pt1->age,pt1->score,pt1->add); pt1=pt1->next; } return 0; }
31
15,454
struct student{ char info[100]; struct student *before; }student[10000]; int main() { void print(struct student *p); int i=0,j; char a[10000][100]; gets(a[0]); while(a[i][0]!='e'){ strcpy(student[i].info,a[i]); i++; gets(a[i]); } student[0].before=NULL; for(j=0;j<=i-1;j++){ student[j+1].before=&student[j]; } print(&student[i-1]); return 0; } void print(struct student *p) { printf("%s\n", p->info); if(p->before!=NULL){print(p->before);} }
31
15,455
int main() { int n=0; struct student { char num[20]; char name[20]; char sex[5]; int age; char score[10]; char add[100]; struct student *next; }*p1,*head,*p2,*end,*p3,*heade; head=NULL; p2=p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if(p1->num[0]!='e') { head=p1; scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->age,p1->score,p1->add); n=1; } p1=(struct student *)malloc(LEN); scanf("%s",p1->num); while(p1->num[0]!='e') { scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->age,p1->score,p1->add); n++; p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); } p2->next=NULL; end=p2; if(n==1) printf("%s %s %s %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->add); else if(n==2) { printf("%s %s %s %d %s %s\n",end->num,end->name,end->sex,end->age,end->score,end->add); printf("%s %s %s %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->add); } else { p1=head; p2=head->next; p3=p2->next; p1->next=NULL; p2->next=p1; while(p3->next!=NULL) { p1=p2; p2=p3; p3=p2->next; p2->next=p1; } p3->next=p2; heade=p3; p1=heade; while(p1!=NULL) { printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->next; } } return 0; }
31
15,456
struct student { char a[1000]; struct student *next; }; void main() { struct student *head,*p1,*p2; p1=head=(struct student*)malloc(LEN); // scanf("%s %s %c %d %d %s",p1->num,p1->name,&p1->sex,&p1->age, // &p1->score,p1->addr); p1->next=NULL; gets(p1->a); while(strcmp(p1->a,"end")) { p2=(struct student*)malloc(LEN); p2->next=p1; p1=p2; gets(p1->a); } while(p1->next!=NULL) { p1=p1->next; printf("%s\n",p1->a); } }
31
15,457
struct student { char xuehao[100]; char name[100]; char s; int age; float score; char add[100]; }; int main() { int i,j,n=0; struct student stu[1000]; for(i=0;i<1000;i++) { scanf("%s",stu[i].xuehao); if(stu[i].xuehao[0]=='e'&&stu[i].xuehao[1]=='n'&&stu[i].xuehao[2]=='d') break; scanf("%s %c %d %f %s",stu[i].name,&stu[i].s,&stu[i].age,&stu[i].score,stu[i].add); n++; } for(j=n-1;j>=0;j--) { if((int)stu[j].score==stu[j].score) printf("%s %s %c %d %d %s\n",stu[j].xuehao,stu[j].name,stu[j].s,stu[j].age,(int)stu[j].score,stu[j].add); else printf("%s %s %c %d %.1f %s\n",stu[j].xuehao,stu[j].name,stu[j].s,stu[j].age,stu[j].score,stu[j].add); } return 0; }
31
15,458
struct student//????????????????? { char num[100]; char name[100]; char gender; int age; float grade; char address[100]; struct student *next; } ; struct student *p1,*p2; struct student *creat()//???????? { int n; struct student *head; n=0; p1=p2=(struct student *)malloc(LEN);//???????*???????????????? scanf("%s %s %c %d %f %s",p1->num,p1->name,&p1->gender,&p1->age,&p1->grade,p1->address); head=NULL; while(strcmp(p1->num,"end")!=0)//???? { n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")!=0) scanf("%s %c %d %f %s\n",p1->name,&p1->gender,&p1->age,&p1->grade,p1->address); } p2->next=NULL; return(head); } void print(struct student *head)//???? { struct student *p1; for(p1=head; p1!=NULL; printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->gender,p1->age,p1->grade,p1->address),p1=p1->next); } //????? struct student * turnback(struct student *head) { struct student *new,*newhead=NULL; do { p2=NULL; p1=head; while(p1->next!=NULL){ p2=p1;p1=p1->next;} if(newhead==NULL) newhead=p1,new=newhead->next=p2; else new=new->next=p2; p2->next=NULL; } while(head->next!=NULL); return(newhead); } void main() { struct student *head; head=creat(); head=turnback(head); print(head); }
31
15,459
struct student { struct student *next; char a[100]; }; int n; struct student *creat() { struct student *p1,*p2,*head; n=0; p1=(struct student *)malloc(sizeof(struct student )); gets(p1->a); p2=p1; head=NULL; while (strcmp(p1->a,"end")!=0) { n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(sizeof(struct student )); gets(p1->a); } p2->next=NULL; return(head); } /*void main() { struct student *p,*head; head=creat(); p=head; while(p!=NULL) { printf("%s\n",p->a); p=p->next; } }*/ void main() { struct student *p1,*head,*p2; head=creat(); p1=head; while(1) { if(p1->next!=NULL) {p2=p1;p1=p1->next;} if(p1->next==NULL&&p2!=head) { printf("%s\n",p1->a); p2->next=NULL; p1=head; } if(p1->next==NULL&&p2==head) break; } printf("%s\n%s",p1->a,head->a); }
31
15,460
struct student { char num[30]; char name[30]; char sex; int age; char score[30]; char add[30]; struct student *next; }; int n=0; void main() { struct student *head,*p1,*p2; p1=p2=(struct student *)malloc(LEN); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add); while(1) { n++; if(n==1) p1->next=NULL; else p1->next=p2; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) break; scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); } head=p2; p1=head; printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); do { p1=p1->next; printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); } while(p1->next!=NULL); }
31
15,461
int main() { struct student { char num[20]; char name[20]; char sex; int age; float mark; char address[20]; struct student *next; struct student *pre; }; struct student *stu; stu=(struct student*)malloc(LEN); stu->pre=NULL; while (1) { scanf ("%s",stu->num); if (strcmp(stu->num,"end")==0) break; scanf ("%s %c %d %f %s",stu->name,&stu->sex,&stu->age,&stu->mark,stu->address); stu->next=(struct student*)malloc(LEN); stu->next->pre=stu; stu=stu->next; } stu=stu->pre; free(stu->next); for ( ;stu!=NULL; ) { printf("%s %s %c %d %g %s\n",stu->num,stu->name,stu->sex,stu->age,stu->mark,stu->address); stu=stu->pre; if (stu!=NULL) free (stu->next); } return 0; }
31
15,462
struct student { char a[80]; struct student *pro; }; struct student *creat() { struct student *end,*p1,*p2; p2=(struct student *)malloc(sizeof(struct student)); gets(p2->a); p2->pro=NULL; p1=p2; do { p2=(struct student *)malloc(sizeof(struct student)); gets(p2->a); if (strcmp(p2->a,"end")==0) { free(p2); break; } else { p2->pro=p1; p1=p2; end=p2; } } while(1); return(end); } void main() { struct student *creat(); void destroy(struct student *end); struct student *end,*p; end=creat(); p=end; do { puts(p->a); p=p->pro; } while (p); }
31
15,463
struct stu {char a[100]; struct stu *next; }; int main() {struct stu *head,*p1,*p2; head=(struct stu *)malloc(sizeof(struct stu)); p1=head; p2=head; p1->next=0; while(1) { gets(p1->a); if(strcmp(p1->a,"end")==0) break; else head=p1; p1=(struct stu *)malloc(sizeof(struct stu)); p1->next=p2; p2=p1; } p1=head; while(1) { puts(p1->a); if(p1->next==0) break; p1=p1->next; } return 0; }
31
15,464
struct xinxi { char stu[1000]; struct xinxi *next; }; void main() { struct xinxi *head,*p,*pt; int i,n; p=(struct xinxi *)malloc(sizeof(struct xinxi)); gets(p->stu); pt=p; head=(struct xinxi *)malloc(sizeof(struct xinxi)); n=0; while(strcmp(p->stu,"end")!=0) { n=n+1; if(n==1)head->next=p; if(n>1)pt->next=p; pt=p; p=(struct xinxi *)malloc(sizeof(struct xinxi)); n=n+1; gets(p->stu); } pt->next=NULL; while(head->next!=NULL) { pt=head; p=head->next; while(p->next!=NULL) {p=p->next; pt=pt->next;} puts(p->stu); pt->next=NULL; } }
31
15,465
char ex[4]={"end"}; struct student { char n[100]; struct student *next; }; void main() { int n=0; struct student *a=NULL,*b=NULL; struct student *head,*p1,*p2; head=NULL; p1=(struct student*)malloc(LEN); p2=NULL; gets(p1->n); while(strcmp(ex,p1->n)!=0) { p1->next=p2; p2=p1; p1=(struct student*)malloc(LEN); gets(p1->n); } p1=NULL; head=p2; a=head; while(a!=NULL) { puts(a->n); b=a->next; a=b; } }
31
15,466
struct list{ char no[10]; char name[20]; char gene; unsigned int age; float score; char add[20]; struct list *next; }; struct list *creat() { struct list *p1=NULL,*p2=NULL,*head; int n=0; do{ p2=p1; p1=(struct list*)malloc(sizeof(struct list)); scanf("%s",p1->no); if(*p1->no=='e') { head=p2; free(p1); break; } scanf("%s %c %d %f %s\n",p1->name,&p1->gene,&p1->age,&p1->score,p1->add); if(n==0)p1->next=NULL; if(n!=0)p1->next=p2; n=1; }while(1); return head; } int main() { struct list *p; p=creat(); while(p!=NULL) { printf("%s %s %c %d %g %s\n",p->no,p->name,p->gene,p->age,p->score,p->add); p=p->next; } return 0; }
31
15,467
struct student{ char stu[50]; struct student *next; }; struct student *Create(); void Insert(struct student *head,struct student *newnode); void Print(struct student *head); int main(){ struct student tmp; struct student *head; head=Create(); gets(tmp.stu); while(strcmp(tmp.stu,"end")!=0){ Insert(head,&tmp); gets(tmp.stu); } Print(head); return 0; } struct student *Create() { struct student *p; p=(struct student *)malloc(sizeof(struct student)); strcpy(p->stu,"0"); p->next=NULL; return p; } void Insert(struct student *head,struct student *tmp) { struct student *p; struct student *newnode; p=head; while(p->next!=NULL) p=p->next; newnode=(struct student *)malloc(sizeof(struct student)); p->next=newnode; strcpy(newnode->stu,tmp->stu); newnode->next=NULL; } void Print(struct student *head) { if(head->next!=NULL) Print(head->next); if(strcmp(head->stu,"0")!=0) printf("%s\n",head->stu); }
31
15,468
int main() { int i,n; char a[MAX][MAX]; for(i=0; ;i++) { gets(a[i]); if(strcmp(a[i],"end")==0) break; } for(n=i-1;n>=0;n--) { puts(a[n]); } return 0; }
31
15,469
// // main.c // Track 82,???????????? // // Created by Charles.thRay.Lee on 2/1/13. // Copyright (c) 2013 Peking University. All rights reserved. /* ?? ??????????????????????????????????????? ???? ????????????????????? 00630018 zhouyan m 20 10.0 28#460 ??????"end"?? ???? ?????????? ????????? ?? ?? ?? ?? ?? ?? ????? ???? 00630018 zhouyan m 20 10 28#4600 0063001 zhouyn f 21 100 28#460000 0063008 zhoyan f 20 1000 28#460000 0063018 zhouan m 21 10000 28#4600000 00613018 zhuyan m 20 100 28#4600 00160018 zouyan f 21 100 28#4600 01030018 houyan m 20 10 28#4600 0630018 zuyan m 21 100 28#4600 10630018 zouan m 20 10 28#46000 00630018 zhouyan m 20 10 28#4600 0063001 zhouyn f 21 100 28#460000 0063008 zhoyan f 20 1000 28#460000 0063018 zhouan m 21 10000 28#4600000 00613018 zhuyan m 20 100 28#4600 00160018 zouyan f 21 100 28#4600 01030018 houyan m 20 10 28#4600 0630018 zuyan m 21 100 28#4600 10630018 zouan m 20 10 28#46000 end ???? 10630018 zouan m 20 10 28#46000 0630018 zuyan m 21 100 28#4600 01030018 houyan m 20 10 28#4600 00160018 zouyan f 21 100 28#4600 00613018 zhuyan m 20 100 28#4600 0063018 zhouan m 21 10000 28#4600000 0063008 zhoyan f 20 1000 28#460000 0063001 zhouyn f 21 100 28#460000 00630018 zhouyan m 20 10 28#4600 */ struct Student { char num[20]; char name[20]; char gender; int age; char score[10]; char address[20]; struct Student*next; struct Student*upper; }; int n; struct Student*creat(void) { struct Student*head,*end; struct Student*p1,*p2; n=0; p1=p2=(struct Student*)malloc(LEN); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->gender,&p1->age,p1->score,p1->address); head=NULL; while (p1->num[0]!='e') { n=n+1; if (n==1) { head=p1; p1->upper=NULL; } else { p2->next=p1; p1->upper=p2; } p2=p1; p1=(struct Student*)malloc(LEN); scanf("%s",p1->num); if (p1->num[0]=='e') { end=p2; break; } scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->address); } p2->next=NULL; return (end); } int main() { struct Student *pt; pt=creat(); do { printf("%s %s %c %d %s %s\n",pt->num,pt->name,pt->gender,pt->age,pt->score,pt->address); pt=pt->upper; } while (pt!=NULL); return 0; }
31
15,470
struct student { char infor[100]; struct student *next; }*p1,*p2; struct student *creat(void) { struct student *head; head=0; p1=0; p2=0; while(1) { p1=(struct student *)malloc(LEN); gets(p1->infor); if(strcmp(p1->infor,"end")==0) break; if(head==0) head=p1; else p2->next=p1; p2=p1; } p2->next=0; return(head); } struct student *turnback(struct student *head) { struct student *newhead=0,*p,*q,*r; do { p=head; q=0; while(p->next!=0) { q=p; p=p->next; } if(newhead==0) { newhead=p; newhead->next=q; } else { r=p; r->next=q; } q->next=0; }while(head->next!=0); return(newhead); } void output(struct student *head) { struct student *p; for(p=head;p->next!=0;p=p->next) printf("%s\n",p->infor); printf("%s\n",p->infor); } void main() { struct student *head; head=creat(); head=turnback(head); output(head); }
31
15,471
struct stu { char num[20]; char name[20]; char sex; int age; char grade[20]; char add[20]; struct stu *p; }; int main () { struct stu *p1,*p2; p1=(struct stu*)malloc(sizeof(struct stu)); p1->p=NULL; scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->grade,p1->add); while(1) { p2=p1; p1=(struct stu*)malloc(sizeof(struct stu)); p1->p=p2; scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->grade,p1->add); if(p1->num[0]=='e') break; } while(p1->p!=NULL) { p1=p1->p; printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->grade,p1->add); } return 0; }
31
15,472
struct student { char id[20]; char name[20]; char sex; int age; char score[20]; char addr[20]; struct student *next; struct student *before; }; int n; struct student *creat(void) { struct student *head,*p1,*p2; n=0; p1=p2=(struct student *)malloc(LEN); scanf("%s",p1->id); head=NULL; while(strcmp(p1->id,"end")!=0) { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr); n=n+1; if(n==1)head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); p1->before=p2; scanf("%s",p1->id); } p2->next=NULL; return(p2); } void main() { struct student *p; int i; p=creat(); printf("%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr); for(i=1;i<n;i++) { p=p->before; printf("\n%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr); } }
31
15,473
int main() { struct stu{ char a[20]; char b[30]; char c; int d; char e[6]; char f[20]; struct stu *be; }; int n=0; struct stu *head=NULL,*p1,*p2; p2=p1=(struct stu *) malloc(LEN); scanf("%s",p1->a); while ( strcmp(p1->a,"end") ) { if(n) p1->be=p2; else p1->be=NULL; n++; scanf("%s %c %d %s %s",(*p1).b,&(*p1).c,&(*p1).d,(*p1).e,(*p1).f); p2=p1; p1=(struct stu *) malloc(LEN); scanf("%s",p1->a); } while (p2!=NULL) { printf("%s %s %c %d %s %s\n",(*p2).a,(*p2).b,(*p2).c,(*p2).d,(*p2).e,(*p2).f); p2=p2->be; } return 0; }
31
15,474
struct student { char num[20]; char name[20]; char sex; int age; float score; char address[20]; struct student *next; }; int n; struct student *creat(void) { struct student *head; struct student *p1,*p2; int num=0; head=NULL; while (1) { p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if (strcmp(p1->num,"end")==0) { p2->next=NULL; break; } else { scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address); if (num==0) head=p1; else p2->next=p1; p2=p1; num++; } } n=num; return (head); } void print (struct student *pt) { struct student *p,*pre; int i; for (i=1;i<=n;i++) { for (p=pre=pt;p->next!=NULL;p=p->next) pre=p; printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); if (p!=pt) { pre->next=NULL; free(p); } } } int main() { struct student *pt; pt=creat(); print(pt); return 0; }
31
15,475
struct student { char num[20]; char name[20]; char sex; int age; char mark[20]; char add[20]; struct student *next; }; void main() { struct student *creat(void); struct student *p; int m=0; p=creat(); while(p!=NULL) { printf("%s %s %c %d %s %s\n",(*p).num,(*p).name,(*p).sex,(*p).age,(*p).mark,(*p).add); p=(*p).next; } ; } int n; struct student *creat(void) { int k; n=0; struct student *head,*p1,*p2; p2=p1=(struct student *)malloc(sizeof(struct student)); scanf("%s%s %c%d%s%s",(*p1).num,(*p1).name,&(*p1).sex,&(*p1).age,(*p1).mark,(*p1).add); while(p2!=NULL) { n=n+1; if(n==1) {(*p2).next=NULL;} else {(*p1).next=p2;} p2=p1; p1=(struct student *)malloc(sizeof(struct student)); scanf("%s",(*p1).num); k=strcmp((*p1).num,"end"); if(k==0) {break;} else if(k!=0) { scanf("%s %c%d%s%s",(*p1).name,&(*p1).sex,&(*p1).age,(*p1).mark,(*p1).add); } } return(p2); }
31
15,476
main() { struct inf { struct inf *pLate; char num[20]; char nam[20]; char gen; int old[20]; int sco[20]; char loc[20]; struct inf *pNext; }; int i,j,k; struct inf *pHeader; pHeader=(struct inf *)malloc(sizeof(struct inf)); struct inf *p; struct inf *p1=NULL; p=pHeader; pHeader->pLate=NULL; for(i=0;;i++) { p->pNext=(struct inf *)malloc(sizeof(struct inf)); p=p->pNext; p->pLate=p1; scanf("%s",p->num); if(p->num[0]=='e') { p->pNext=NULL; break; } else { scanf("%s %c %s %s %s",p->nam,&p->gen,p->old,p->sco,p->loc); p1=p; } } for(j=i;j>=1;j--) { p=p->pLate; printf("%s %s %c %s %s %s\n",p->num,p->nam,p->gen,p->old,p->sco,p->loc); } p=pHeader; struct inf *pd; for(k=0;k<=i;k++) { pd=p; p=p->pNext; free(pd); } free(p); }
31
15,477
struct stu{ char no[10]; char name[20]; char gene; unsigned int age; float score; char add[20]; struct list *next; }; struct stu *creat() { struct stu *p1=NULL,*p2=NULL,*head; int n=0; do{ p2=p1; p1=(struct stu*)malloc(sizeof(struct stu)); scanf("%s",p1->no); if(*p1->no=='e') { head=p2; free(p1); break; } scanf("%s %c %d %f %s\n",p1->name,&p1->gene,&p1->age,&p1->score,p1->add); if(n==0)p1->next=NULL; if(n!=0)p1->next=p2; n=1; }while(1); return head; } void print(struct stu *head) { struct stu *p; p=head; while(p!=NULL) { printf("%s %s %c %d %g %s\n",p->no,p->name,p->gene,p->age,p->score,p->add); p=p->next; } } int main() { struct stu *head; head=creat(); print(head); return 0; }
31
15,478
struct stu {char num[50]; struct stu * next; }; void main() { struct stu * head,*p1,*p2; int i=1; p1=p2=(struct stu *)malloc(L); gets(p1->num); head=p1; while((strcmp(p1->num,"end")!=0)) { p1=(struct stu*) malloc(L); gets(p1->num); p2->next=p1; p2=p1;i++; } p2->next=0; int k; for(;i>1;i--) { k=i; for(p1=head;k>2;k--) {p1=p1->next;} printf("%s\n",p1->num); } }
31
15,479
struct stu { char num[111]; char name[111]; char gender; int age; char score[11111]; char add[111]; struct stu *next; }; int n; struct stu *creat() { struct stu *head; struct stu *p1,*p2; n=0; p1=(struct stu *)malloc(L); scanf("%s",p1->num); if(strcmp(p1->num,"end")) scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->add); else return NULL; while(1) { n=n+1; if(n==1) p1->next=NULL; else p1->next=p2; p2=p1; p1=(struct stu *)malloc(L); scanf("%s",p1->num); if(strcmp(p1->num,"end")) scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->add); else break; } head=p2; return(head); } void main() { int i; struct stu *p; p=creat(); while(p) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->gender,p->age,p->score,p->add); p=p->next; } }
31
15,480
struct student { char s[100]; struct student *next; }; int n; struct student *creat( ) { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student*)malloc(len); gets(p1->s); head=0; while(strcmp(p1->s,"end")!=0) { n++; if(n==1)head=p1; else p1->next=p2; p2=p1; p1=(struct student*)malloc(len); gets(p1->s); } head->next=0; return(p2); } void print(struct student *head) { struct student *p; p=head; if(head!=0) do { printf("%s\n",p->s); p=p->next; }while(p!=0); } int main() { struct student *p; p=creat(); print(p); }
31
15,481
struct Info { char num[10]; char name[20]; char sex; int age; char score[10]; char address[20]; struct Info* next; struct Info* former; }; int main() { struct Info *head,*p1,*p2,*p,*tail; head=(struct Info*)malloc(sizeof(struct Info)); p1=head; p2=head; char temp[10]; scanf("%s %s %c %d %s %s",p2->num,p2->name,&p2->sex,&p2->age,p2->score,p2->address); head->former=NULL; head->next=NULL; p2=(struct Info*)malloc(sizeof(struct Info)); while(1) { scanf("%s",temp); if (strcmp(temp,"end")!=0) { strcpy(p2->num,temp); scanf("%s %c %d %s %s",p2->name,&p2->sex,&p2->age,p2->score,p2->address); p2->former=p1; p2->next=NULL; p1->next=p2; p1=p2; p2=(struct Info*)malloc(sizeof(struct Info)); } else { tail=p1; break; } } p=tail; do { if((p->score-(int)p->score)!=0) printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); else printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); p=p->former; } while(p!=NULL); return 0;}
31
15,482
void main() { struct stu { char num[21]; char name[31]; char sex[2]; int age; float score; char address[31]; struct stu *next; struct stu *pre; }; struct stu *head,*p1,*p2,*tail; head=(struct stu *)malloc(sizeof(struct stu)); p1=head; p2=p1; p1->pre=NULL; scanf("%s",&p1->num); if (strcmp(p1->num,"end")) { while(strcmp(p1->num,"end")) { scanf("%s",&p1->name); scanf("%s",&p1->sex); scanf("%d",&p1->age); scanf("%f",&p1->score); scanf("%s",&p1->address); p2=(struct stu*)malloc(sizeof(struct stu)); p1->next=p2; p2->pre=p1; p1=p2; scanf("%s",&p1->num); } tail=p1->pre; free(p1); tail->next=NULL; p1=tail; p2=p1; while(p1!=NULL) { printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address); p2=p1->pre; p1=p2; } p1=head; p2=p1; while(p1!=NULL) { p2=p1->next; free(p1); p1=p2; } } else free(head); }
31
15,483
struct student { char num[30]; char name[30]; char sex; int age; char score[20]; char add[30]; struct student *next; }; int main() { struct student *p,*p1; int n=0; p=(struct student *)malloc(LEN); scanf("%s %s %c %d %s %s",p->num,p->name,&p->sex,&p->age,p->score,p->add); //printf("%s %s %c %d %f %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); //printf("%c\n",p->num[0]); while(1) { n++; if(n==1) p->next=NULL; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); //printf("%s\n",p1->num); if(strcmp(p1->num,"end")==0) break; else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); //printf("%s %s %c %d %f %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); p1->next=p; p=p1; //printf("%d\n",n); } //printf("%d\n",n); while(p!=NULL) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; } return 0; }
31
15,484
struct student { char id[50]; char *name; char sex; short int age; float score; char *add; struct student *next; }; int n; struct student *creat(void) { struct student *p1,*head,*p2; n=0; head=NULL; p2=p1=(struct student*)malloc(sizeof(struct student)); gets(p1->id); while(strcmp(p1->id,"end")!=0) { n++; if(n==1) p1->next=NULL; else { p1->next=p2; } p2=p1; head=p2; p1=(struct student*)malloc(sizeof(struct student)); gets(p1->id); } return head; } void print(struct student *head) { struct student *p; p=head; while(p!=NULL) { printf("%s\n",p->id); p=p->next; } } main() { struct student *head; head=creat(); print(head); }
31
15,485
struct student { char str[1000]; struct student *next; }; struct student *create(void) { struct student *head; struct student *p1,*p,*p2; head=p1=(struct student *)malloc(len); gets(p1->str); p1->next=0; p2=p1; while(strcmp(p1->str,"end")!=0) { p=head; head=p1; head->next=p; p1=(struct student *)malloc(len); gets(p1->str); } p2->next=0; return(head); } void print(struct student *head) { struct student *p1; p1=head; if(head!=0) do { puts(p1->str); p1=p1->next; }while(p1!=0); } void main() { struct student *head; head=create(); print(head); }
31
15,486
struct student { char a[100]; struct student *next; }; int n; void main() { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(L); gets(p1->a); head=NULL; while(strcmp(p1->a,"end")!=0) { n=n+1; if(n==1)head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(L); gets(p1->a); } p2->next=NULL; int i,k; struct student *j; j=head; for(k=n-1;k>-1;k--) { for(i=0;i<k;i++) j=j->next; puts(j->a); j=head; } }
31
15,487
struct stu { char a[100]; struct stu *prev; struct stu *next; }; void main() { struct stu *end,*p1,*p2,*head; int m,n,j; p1=(struct stu*)malloc(sizeof(struct stu)); end=p1; p2=p1; gets(p1->a); p1->next=0; scanf("\n"); for(;;) { p1=(struct stu*)malloc(sizeof(struct stu)); gets(p1->a); scanf("\n"); if(strcmp(p1->a,"end")==0) { head=p2; break; } else { p1->next=p2; p2=p1; } } for(;head!=0;head=head->next) { puts(head->a); } }
31
15,488
typedef struct Node{ char content[150];//??????????????????????????????) struct Node *next;//?????? struct Node *front; }node,*ptr; main() { char temp[150],std[4] = "end";//std??????? ptr head = NULL,p,q;//head??? while(1){ gets(temp); if(strcmp(temp,std) != 0){ p = (ptr)malloc(sizeof(node)); strcpy(p->content,temp); p->next = NULL; p->front = NULL; if(head == NULL) head = p; else{ q->next = p; p->front = q; } q = p; } else break; } while(p != NULL){ printf("%s\n",p->content); p = p->front; } }
31
15,489
struct student { char num[10]; char name[20]; char s; int age; char score[20]; char address[30]; struct student *next; }; int main() { struct student *p1,*p2; p1=(struct student *)malloc(LEN); p1->next=0; scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->s,&p1->age,&p1->score,p1->address); while(1) { p2=p1; p1=(struct student *)malloc(LEN); p1->next=p2; scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->s,&p1->age,&p1->score,p1->address); if(p1->num[0]== 'e') break; } while(p1->next!=0) { p1=p1->next; printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->s,p1->age,p1->score,p1->address); } return 0; }
31
15,490
struct student { char xuehao[200]; char name[300]; char xingbie; char age[20]; char grade[20]; char dizhi[200]; struct student *next; }; int main() { int i; int n=0; struct student *tail; struct student *p1,*p2,*p; tail=NULL; p1=p2=NULL; for(i=1;;) { p1=(struct student*)malloc(LEN); p1->next=p2; scanf("%s",p1->xuehao); if(strcmp(p1->xuehao,"end")==0) { tail=p2; break; } scanf("%s",p1->name); getchar(); scanf("%c",&p1->xingbie); scanf("%s",p1->age); scanf("%s",p1->grade); scanf("%s",p1->dizhi); p2=p1; i++; } n=i-1; A: p=tail; for(;p!=NULL;) { printf("%s %s %c %s %s %s\n",p->xuehao,p->name,p->xingbie,p->age,p->grade,p->dizhi); p=p->next; } return 0; }
31
15,491
//#include <memory.h> struct information {char info[50]; struct information*next; }; struct information* creat() {struct information *head,*p1,*p2; p1=p2=(struct information*)malloc(len); p1->next=NULL; gets(p1->info); while(strcmp(p1->info,"end")!=0) {p2=p1; p1=(struct information*)malloc(len); gets(p1->info); p1->next=p2; } return p2; } void print(struct information*head) { while(head!=NULL) {printf("%s\n",head->info); head=head->next; } } main() {struct information*head; head=creat(); print(head); }
31
15,492
struct student { char temp[50]; struct student *previous; }; void main() { struct student *end,*head; struct student *p1,*p2, *p; /*p1=(struct student *)malloc(LEN);*/ p2=head=NULL; while(1) { p1=(struct student*)malloc(LEN); gets(p1->temp); if (strcmp(p1->temp,"end")==0) { /*delete p1;*/ break; } if(head==NULL) { head=p1; head->previous=NULL; } else p1->previous=p2; p2=p1; } /*p1->previous=p2;*/ p=p2; if(p!=NULL) while(p) { puts(p->temp); p=p->previous; } }
31
15,493
struct student { char num[100]; char name[100]; char sex; int age; char score[20]; char address[100]; struct student *next; }; struct student *creat() { struct student *head,*p1,*p2; p1 = (struct student*)malloc(len); p2 = p1; scanf("%s",p1->num); if(strcmp(p1->num,"end") == 0) {head = p1;p1->next = NULL;} else { scanf(wtf); p1->next = NULL; for (;;) { p1 = (struct student*)malloc(len); scanf("%s",p1->num); if(strcmp(p1->num,"end") == 0) break; scanf(wtf); p1->next = p2; p2 = p1; } head = p2; } return(head); } main() { struct student *p; p = creat(); if (p->next == NULL) printf("\n"); else { for(;p!=NULL;) { printf(wtf2); p = p->next; } } }
31
15,494
struct Student { char information[200]; struct Student *next; }; int n; struct Student*creat() { struct Student *p1,*p2,*head; n=0; p1=p2=(struct Student *)malloc(LEN); gets(p1->information); head=NULL; while(strcmp(p1->information,"end")!=0) { n=n+1; if(n==1) { p1->next=NULL; } else { p1->next=p2; } p2=p1; p1=(struct Student *)malloc(LEN); gets(p1->information); } head=p2; return(head); } void print(struct Student *head) { struct Student *p; p=head; if(head!=NULL) do { printf("%s\n",p->information); p=p->next; } while(p!=NULL); } int main() { struct Student * head; head=creat(); print(head); return 0; }
31
15,495
struct student{ char num[20]; char name[30]; char sex; int age; float score; char adress[30]; struct student *next; struct student *last; }; int n=1; struct student *ANewNode(void) { struct student *head=NULL,*newnode,*thisnode; do { newnode=(struct student *)malloc(sizeof(struct student)); scanf("%s",newnode->num); if(strcmp(newnode->num,"end")==0) { thisnode->next=NULL; head=thisnode; break; } else; scanf("%s %c %d %f %s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->adress); if(n==1) { head=newnode; thisnode=head; thisnode->last=NULL; } else { thisnode->next=newnode; newnode->last=thisnode; } thisnode=newnode; n=n+1; }while(strcmp(newnode->num,"enff")!=0); return(head); } int main() { struct student *head,*p; head=ANewNode(); p=head; do { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->adress); p=p->last; }while(p!=NULL); scanf("%d",&n); return 0; }
31
15,496
struct student { char id[50]; char s[50]; char sex; int age; char score[10]; char add[20]; struct student *po; }; int main() { struct student *p,*q; q=(struct student*)malloc(LEN); scanf("%s %s %c %d %s %s",q->id,q->s,&q->sex,&q->age,q->score,q->add); q->po=NULL; p=q; q=(struct student*)malloc(LEN); scanf("%s",q->id); while(strcmp(q->id,"end")!=0) { scanf("%s %c %d %s %s",q->s,&q->sex,&q->age,q->score,q->add); q->po=p; p=q; q=(struct student*)malloc(LEN); scanf("%s",q->id); } printf("%s %s %c %d %s %s\n",p->id,p->s,p->sex,p->age,p->score,p->add); while(p->po!=NULL) { p=p->po; printf("%s %s %c %d %s %s\n",p->id,p->s,p->sex,p->age,p->score,p->add); } return 0; }
31
15,497
struct student { char id[10]; char name[20]; char sex[2]; int age; char s[10]; char add[20]; struct student *next; }; struct student *creat(void) { struct student *head,*p1,*p2; int i=0; p1=p2=(struct student*)malloc(LEN); head=NULL; while(scanf("%s",p1->id)&&*p1->id>=48&&*p1->id<=57) { scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->s,p1->add); if(i==0)head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); i++; } p2->next=NULL; return (head); } void turn(struct student *head) { struct student *p1,*p2; p2=p1=head; while(head->next!=NULL) { while(p1->next!=NULL) { p2=p1; p1=p1->next; } printf("%s %s %s %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->s,p1->add); p2->next=NULL;p1=head; } printf("%s %s %s %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->s,p1->add); } void main() { struct student *head; head=creat(); turn(head); }
31
15,498
struct student { char number[20]; char name[20]; char sex[2]; int year; float score; char address[100]; struct student *next; }; int main() { struct student *p1,*p2; p1=(struct student *)malloc(sizeof(struct student)); p1->next=NULL; scanf("%s",p1->number); while(p1->number[0]!='e') { scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->year,&p1->score,p1->address); p2=p1; p1=(struct student *)malloc(sizeof(struct student)); p1->next=p2; scanf("%s",p1->number); } while(p2!=NULL) { printf("%s %s %s %d %g %s\n",p2->number,p2->name,p2->sex,p2->year,p2->score,p2->address); p2=p2->next; } return 0; }
31
15,499
struct student { char ID[20]; char name[20]; char sex; int age; char score[20]; char address[20]; struct student *next; struct student *before; }; struct student *create() { struct student *head,*p1,*p2,*end; p1=(struct student*)malloc(LEN); scanf("%s",p1->ID); if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;end=NULL;} else { head=p1; scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); p1->next=NULL; p1->before=NULL; p2=p1; do { p1=(struct student*)malloc(LEN); p1->before=p2; p1->next=NULL; scanf("%s",p1->ID); if(strcmp(p1->ID,"end")==0){p2->next=NULL;end=p2;free(p1);break;} else { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); p2->next=p1; p1->before=p2; p1->next=NULL; p2=p1; } }while(1); } return(end); } void print(struct student *end) { struct student *p; p=end; while(p) {printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address); p=p->before; } } int main() { struct student *end; end=create(); print(end); }
31