label
stringlengths
1
2
index
stringlengths
1
5
code
stringlengths
87
8.24k
31
15400
struct student { char num[50]; char name[20]; char sex; int year; char score[10]; char add[50]; struct student *next; }; int n; struct student *Create() { struct student *head; struct student *p1=NULL; struct student *p2=NULL; n = 0; p1 = (struct student *)malloc(LEN); p2 = p1; head = NULL; scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->year,p1->score,p1->add); int j=0; for(;;j++) { n += 1; if (n==1) { head = p1; p2->next = NULL; } else { p2->next = p1; } p2 = p1; p1 = (struct student *)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) { p2->next=NULL; break; } scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add); } p2->next = NULL; free(p1); p1 = NULL; return head; } struct student *Reverse(struct student *head) { struct student *p; struct student *p1; struct student *p2; p1 = NULL; p2 = head; while (p2 != NULL) { p = p2->next; p2->next = p1; p1 = p2; p2 = p; } head = p1; return head; } void Print(struct student *head) { struct student *p; p = head; if(head != NULL) { do { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add); p = p->next; } while (p != NULL); } } int main() { struct student *head; head = Create(); head = Reverse(head); Print(head); return 0; }
31
15401
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
15402
struct student { char inf[200]; struct student *prev; }; struct student *creat() { struct student *p1,*p2,*head; p1=p2=(struct student *)malloc(sizeof(struct student)); gets(p1->inf); p1->prev=0; while(p1->inf[0]!='e') { p2=p1; p1=(struct student *)malloc(sizeof(struct student)); gets(p1->inf); p1->prev=p2; } return(p2); } void print_f(struct student *head) { struct student *p1; p1=head; while(p1!=0) { printf("%s\n",p1->inf); p1=p1->prev; } } void main() { print_f(creat()); }
31
15403
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
15404
struct student { char num[20]; char name[20]; char sex; int age; char score[20]; char add[20]; struct student *next; }; void main() { struct student *p1,*p2; p1=p2=(struct student *)malloc(sizeof(struct student)); p1->next=NULL; while(1) { scanf("%s",p1->num); if(strcmp(p1->num,"end")!=0) { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); p1=(struct student *)malloc(sizeof(struct student)); p1->next=p2; p2=p1; } else break; } p1=p1->next; while(p1->next!=NULL) { printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->next; } printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); }
31
15405
char a[]="end"; struct student { struct student *last; char num[50]; char name[50]; char sex; int age; char grade[50]; char address[50]; struct student *next; }; struct student *Appendnewnode() { struct student *head=NULL, *newnode, *thisnode,*end; int i=0; do { newnode=(struct student *)malloc(sizeof(struct student)); if(newnode==NULL) { printf("Memory request failed!"); exit(-1); } scanf("%s",newnode->num); if(strcmp(newnode->num,a)!=0) scanf("%s %c %d %s %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address); if(i==0) { head=newnode; thisnode=head; newnode->last=NULL; if(strcmp(newnode->num,a)!=0) newnode->next=NULL; i++; } else { thisnode->next=newnode; newnode->last=thisnode; if(strcmp(newnode->num,a)!=0) thisnode=newnode; } }while(strcmp(newnode->num,a)!=0); end=thisnode; thisnode->next=NULL; return(end); } void main() { struct student *end, *p; end=Appendnewnode(); for(p=end;p->last!=NULL;p=p->last) printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address); printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address); }
31
15406
struct student { char id[400]; struct student *pre; }; int main() { int i=1,n=0; struct student a[1000],*head,*p; do { gets(a[i].id); i++; n++; } while(a[i-1].id[0]!='e'); head=&a[n-1]; for(i=n-1;i>=2;i--) {a[i].pre=&a[i-1];} a[1].pre=NULL; p=head; for(i=1;i<=n-1;i++) { puts(p->id); p=p->pre; } return 0; }
31
15407
int n; struct student {char string[10000]; struct student *next; }; struct student *create(void) { struct student *tail,*p1,*p2,*head; n=0; p1=p2=(struct student *)malloc(Len); gets(p1->string); tail=NULL; while(strcmp(p1->string,"end")!=0) { n=n+1; if(n==1) { tail=p1; p1->next=NULL; } else { p1->next=p2; } p2=p1; p1=(struct student *)malloc(Len); gets(p1->string); } head=p2; return head; } void main() { struct student *head,*p; head=create(); p=head; do { puts(p->string); p=p->next; } while (p!=NULL); }
31
15408
struct student { char id[15]; char name[20]; char sex; int age; char grade[20]; char add[20]; struct student *next; }; struct student *set(void) { struct student *head,*p1,*p2; head=(struct student *)malloc(LEN); p1=head; p2=head; scanf("%s%s %c %d %s %s",head->id,head->name,&head->sex,&head->age,head->grade,head->add); p1=(struct student *)malloc(LEN); scanf("%s%s %c %d %s %s",p1->id,p1->name,&p1->sex,&p1->age,p1->grade,p1->add); p2->next=p1; p2=p1; while(1) { p1=(struct student *)malloc(LEN); scanf("%s",p1->id); if(strcmp(p1->id,"end")==0) { p2->next=NULL; break; } scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add); p2->next=p1; p2=p1; } return(head); } int main() { struct student *p,*p1,*p2,*p3; int i,j,n=1; p=set(); p1=p;p1=p1->next;p1=p1->next; p2=p;p2=p2->next; p3=p; while(p1!=NULL) { p2->next=p3; p3=p2;p2=p1;p1=p1->next; } p2->next=p3; //????????????????p2???? p->next=NULL; //???????p?????? p1=p2; //?p1??????????????????? while(p1!=NULL) { printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->grade,p1->add); p1=p1->next; } return 0; }
31
15409
struct a { struct a *back; char a[20]; char b[20]; char c; char d[20]; char e[20]; char f[20]; struct a *next; }; int main() { struct a *pHeader,*pEnd,*p1; struct a *p; pHeader=(struct a*)malloc(sizeof(struct a)); pHeader->back=NULL; p1=pHeader; for(;;) { p=(struct a*)malloc(sizeof(struct a)); scanf("%s",p->a); if(p->a[0]=='e') { pEnd=p; p->back=p1; p1->next=p; p->next=NULL; break; } p->back=p1; p1->next=p; p1=p; scanf("%s %c %s %s %s",p->b,&p->c,p->d,p->e,p->f); } printf("%s %s %c %s %s %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f); free(p1->next); for(;;) { printf("%s %s %c %s %s %s\n",p1->back->a,p1->back->b,p1->back->c,p1->back->d,p1->back->e,p1->back->f); p1=p1->back; free(p1->next); if(p1->back==NULL) break; } }
31
15410
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
15411
struct student { char xuehao[200]; struct student *next; }; struct student *create(n) { struct student *p1,*p2,*head; p1=p2=(struct student*)malloc(sizeof(struct student)); p1->next=0; gets(p1->xuehao); while(p1->xuehao[0]!='e') { p2=p1; p1=(struct student*)malloc(sizeof(struct student)); p1->next=p2; gets(p1->xuehao); } head=p2; return(head); } int main() { struct student *p1; int n; p1=create(n); while(p1!=0) { printf("%s\n",p1->xuehao); p1=p1->next; } }
31
15412
struct student { char information[200]; struct student *next; }; struct student *creat(void) { int n=0; struct student *head; struct student *p1,*p2; p1=(struct student *)malloc(LEN); gets(p1->information); p1->next=NULL; p2=p1; do { p1=(struct student *)malloc(LEN); gets(p1->information); if(strcmp(p1->information,"end")==0) { free(p1); head=p2; break; } else { p1->next=p2; head=p1; p2=p1; } } while(1); return(head); } void print(struct student *head) { struct student *p; p=head; if(head!=NULL) { do { puts(p->information); p=p->next; } while(p!=NULL); } } void main() { struct student *head; head=creat(); print(head); }
31
15413
struct Stu { char num[20]; char name[50]; char sex; int age; char mark[50]; char add[50]; struct Stu *link; }; void main() { struct Stu *p1,*p2; p1=(struct Stu *)malloc(LEN); p2=p1; scanf("%s",p1->num); p1->link=NULL; while(strcmp(p1->num,"end")!=0) { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->mark,p1->add); p1=(struct Stu *)malloc(LEN); p1->link=p2; scanf("%s",p1->num); p2=p1; } struct Stu *p; p=p1->link; while(p!=NULL) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add); p1=p->link; free(p); p=p1; } }
31
15414
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
15415
int n=0; struct student { char s[200]; struct student *next; }; struct student *creat() { char k[200]; struct student *p,*head; head=p=(struct student *)malloc(LEN); while(1) { gets(k); if(!(strcmp(k,"end"))) break; else { if(n==0) {head->next=NULL;n=1;} else p->next=head; head=p; strcpy(p->s,k); p=(struct student *)malloc(LEN); } } free(p); return (head); } void print(struct student *p) { if(p!=NULL) { puts(p->s); print(p->next); } } int main() { struct student *head; head=creat(); print(head); return 0; }
31
15416
struct student { char num[20]; char name[21]; char sex; int age; char score[20]; char address[21]; struct student *next; }; int n; struct student *create(void) { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(length); scanf("%s",p1->num); head=null; while(strcmp(p1->num,"end")!=0) { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(length); scanf("%s",p1->num); } p2->next=null; return head; } void print(struct student *head) { struct student *p,*q; p=head; if(head!=null) { do { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); q=p; p=p->next; free(q); } while(p!=null); } } struct student *converse(struct student *head) { struct student *p1,*p2,*p3; p1=p2=head; if(head!=null) { while(p2->next!=null) { p3=p2->next; if(p2==head) p2->next=null; else p2->next=p1; p1=p2; p2=p3; } p2->next=p1; head=p2; } return head; } void main() { struct student *p=create(); p=converse(p); print(p); }
31
15417
struct stu { char infor[1000]; struct stu *next; } *p1,*p2; struct stu *creat(void) { struct stu *head=NULL; p2=p1=(struct stu*)malloc(sizeof(struct stu)); gets(p1->infor); while(strcmp(p1->infor,"end")) { if(head==NULL) head=p1; else p2->next=p1;p2=p1; p1=(struct stu*)malloc(sizeof(struct stu)); gets(p1->infor); } p2->next=NULL; return(head); } struct stu *back(struct stu *head) { struct stu *newp,*newhead=NULL; do{ p2=NULL;p1=head; while(p1->next!=NULL) {p2=p1;p1=p1->next;} if(newhead==NULL) newhead=p1,newp=newhead->next=p2; newp=newp->next=p2; p2->next=NULL; }while(head->next!=NULL); return (newhead); } void main() {struct stu *head; head=creat(); head=back(head); for(p1=head;p1!=NULL;p1=p1->next) printf("%s\n",p1->infor); }
31
15418
struct s { char a[100]; char b[100]; char c; int d; char e[100]; char f[100]; struct s *t; }k[1000]; int n; int main(int argc, char *argv[]) { int i; struct s *head,*p; for(i=0;;i++) { scanf("%s",k[i].a); if(strcmp(k[i].a,"end")==0) break; scanf(" %s %c %d %s %s",k[i].b,&k[i].c,&k[i].d,k[i].e,k[i].f); if(i>0) k[i].t=&k[i-1]; if(i==0) k[i].t=NULL; } head=&k[i-1]; p=head; do{ printf("%s %s %c %d %s %s\n",p->a,p->b,p->c,p->d,p->e,p->f); p=p->t;} while(p!=NULL); return 0; }
31
15419
char info[1000][1000]; int main() { int k=0; while(1) { cin.getline(info[k],999); if (info[k++][0]=='e') break; } k-=2; for (;k>=0;k--) { cout<<info[k]<<endl; } return 0; }
31
15420
struct student { char str[100]; struct student *next; }; struct student *creat(void) {struct student *head; struct student *p1,*p2,*p3; p1=p2=p3=(struct student *)malloc(LEN); gets(p1->str); while(strcmp(p1->str,"end")!=0) { p1=(struct student *)malloc(LEN); gets(p1->str); head=p1; p1->next=p2; p2=p1; } p3->next=0; return(head); } void print(struct student *head) { struct student *p; p=head->next; do { puts(p->str); p=p->next; }while (p->next!=0); puts(p->str); } main() { struct student *head; head=creat(); print(head); }
31
15421
struct student { char id[100],name[100],sex[2]; char sco[100]; int age; char pos[100]; struct student *pre; }; int n; struct student*creat(void) { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student*)malloc(LEN); scanf("%s",&p1->id); if(strcmp(p1->id,"end")!=0) { scanf("%s%s%d%s%s",&p1->name,&p1->sex,&p1->age,&p1->sco,&p1->pos); } head=NULL; while(strcmp(p2->id,"end")!=0) { n=n+1; if(n==1) { head=p1; p1->pre=NULL; } else p2->pre=p1; p1=p2; p2=(struct student*)malloc(LEN); scanf("%s",&p2->id); if(strcmp(p2->id,"end")!=0) { scanf("%s%s%d%s%s",&p2->name,&p2->sex,&p2->age,&p2->sco,&p2->pos); } } return p1; } void print(struct student*head) { struct student*p; p=head; if(head!=NULL&&strcmp(head->id,"end")!=0) { do { printf("%s %s %s %d %s %s\n",p->id,p->name,p->sex,p->age,p->sco,p->pos); p=p->pre; }while(p!=NULL); } } main() { struct student*last; last=creat(); print(last); return 0; }
31
15422
struct student { char info[100]; struct student *next; }; int n; struct student*creat(void) {struct student *head,*p1,*p2; p1=p2=(struct student*)malloc(LEN); gets(p1->info); p1->next=null; while(strcmp("end",p1->info)!=0) {head=p1; p1=(struct student*)malloc(LEN); p1->next=p2; p2=p1; gets(p1->info); } return(head); } void print(struct student*head) {struct student*p; p=head; while(p!=null) {printf("%s\n",p->info); p=p->next; } } main() {struct student*head; head=creat(); print(head); }
31
15423
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
15424
struct stu { char num[1000]; struct stu*next; }; struct stu*f() { struct stu*head; struct stu*p,*q; p=q=0; p=(struct stu*)malloc(l); p->next=q; gets(p->num); q=p; while(1) { p=(struct stu*)malloc(l); p->next=q; q=p; gets(p->num); if(p->num[0]=='e') break; } head=p; return(head); } void y(struct stu*head) { struct stu*p,*q; p=q=head; p=q->next; while(p!=0) { puts(p->num); q=p; p=q->next; } } main() { y(f()); return 0; }
31
15425
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
15426
struct stu {char num[50]; char name[50]; char gentle; int age; int score; char add[50]; struct stu *next; }; int n; struct stu *creat(void) { struct stu *head,*p1,*p2; n=0; p1=p2=(struct stu *)malloc(sizeof(struct stu)); gets(p1->num); head=NULL; while(strcmp(p1->num,"end")!=0) { n++; if(n==1) p1->next=NULL; else {p1->next=p2;} p2=p1; head=p2; p1=(struct stu *)malloc(sizeof(struct stu)); gets(p1->num); } return head; } void print(struct stu *head) { struct stu *p; p=head; while(p!=NULL) { printf("%s\n",p->num); p=p->next; } } void main() { struct stu *head; head=creat(); print(head); }
31
15427
struct student { char num[20]; char name[20]; char sex; int age; char score[20]; char adress[20]; struct student *next; }; int n; struct student *input(void) { struct student *p,*q,*head; int n=0; p=q=(struct student *)malloc(sizeof(struct student)); scanf("%s %s %c %d %s %s\n",p->num,p->name,&p->sex,&p->age,p->score,p->adress); head=null; while(strcmp(p->num,"end")!=0) { n=n+1; if(n==1) { head=p; } else { q->next=p; } q=p; p=(struct student*)malloc(sizeof(struct student)); scanf("%s %s %c %d %s %s\n",p->num,p->name,&p->sex,&p->age,p->score,p->adress); } q->next=null; return(head); } void output(struct student *head) { struct student *p; p=head; if(head!=null) do { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adress); p=p->next; } while(p!=null); } struct student *exchange(struct student * head) { struct student *p,*q,* n,* nhead=null; do{ q=null; p=head; while(p->next!=null) { q=p; p=p->next; } if(nhead==null) { nhead=p; n=nhead->next=q; } n=n->next=q; q->next=null; }while(head->next!=null); return(nhead); } int main() { struct student *input(void); struct student *exchange(struct student *); void output(struct student *); struct student *a,*b; a=input();//??input???????a b=exchange(a); output(b); return 0; }
31
15428
struct STUDENT { struct STUDENT *former; char num[20]; char name[20]; char sex; int age; float score; char address[20]; struct STUDENT *next; }; struct STUDENT stu; void main() { struct STUDENT *head,*p1,*p2,*p3; head=p1=p2=&stu; p3=NULL; for (;;) { scanf ("%s",p1->num); if (p1->num[0]=='e') { p2=p1->next; p2=NULL; p1=p3; break; } scanf ("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address); p2=p1->next; p2=(struct STUDENT *)malloc(LEN); p1->former=p3; p3=p1; p1=p2; } for (;;) { printf ("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address); p2=p1->former; p1=p2; if (p2==NULL) break; } }
31
15429
struct student { char a[200]; struct student *next; }; struct student *creat () { struct student *p1,*p2,*head; int 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,*q; head=creat(); p=head; while(1) { if(p->next!=NULL){q=p;p=p->next;} if(p->next==NULL&&q!=head) { printf("%s\n",p->a); q->next=NULL;p=head; } if(p->next==NULL&&q==head) { printf("%s\n",p->a); printf("%s",q->a);break; } } }
31
15430
struct student { char NO[20]; char name[20]; char sex; int age; char score[20]; char add[20]; struct student *prev; }; void main() { struct student *END; struct student *p1,*p2; p1=p2=(struct student*)malloc(LEN); scanf("%s %s %c %d %s %s",&p1->NO,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add); p1->prev=0; p1=(struct student*)malloc(LEN); for(;;) { scanf("%s",&p1->NO); if(strcmp(p1->NO,"end")==0) { END=p2; break; } scanf(" %s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add); p1->prev=p2; p2=p1; p1=(struct student*)malloc(LEN); } for(p1=END;p1!=0;) { printf("%s %s %c %d %s %s\n",p1->NO,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->prev; } }
31
15431
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
15432
struct student { char num[20]; char name[20]; char sex; int age; char score[10]; char add[30]; struct student *next; }*p1,*p2; struct student *input(void) { char temp[100]={0}; struct student *head=NULL; while(gets(temp)) { if(strcmp(temp,"end")==0)break; p1=(struct student *)malloc(sizeof(struct student)); sscanf(temp,"%s%s %c %d %s%s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add); if(head==NULL) { head=p1,p2=p1; } else { p2->next=p1; p2=p1; p2->next=NULL; } } return(head); } struct student *sort(struct student *head) { struct student *n,*newhead=NULL; do { p2=NULL; p1=head; while(p1->next!=NULL) p2=p1,p1=p1->next; if(newhead==NULL) newhead=p1,n=newhead->next=p2; n=n->next=p2; p2->next=NULL; }while(head->next!=NULL); return(newhead); } void output(struct student *outhead) { for(p1=outhead;p1!=NULL;p1=p1->next) printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); } int main() { struct student *head; head=input(); head=sort(head); output(head); printf("\n"); return 0; }
31
15433
struct student//????? { char num[20]; char name[20]; char sex; int age; char score[20]; char add[30]; struct student *next; }; struct student *creat(void)//????????CREAT????? { struct student *p1,*p2; p1=p2=(struct student *)malloc(LEN);//???????? p2->next=NULL; scanf("%s",p1->num);//??num while(strcmp(p1->num,"end")!=0)//?NUM???????? { scanf("%s %c%d%s%s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);//???????? p1=(struct student *)malloc(LEN);//??????? p1->next=p2;//???? p2=p1; scanf("%s",p1->num);//???????? } return(p2); } void print(struct student *head)//?????? { struct student *p; p=head->next; if(p!=NULL) do {printf("%s %s %c %d %s %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; struct student *creat(void);//???? void print(struct student *);//???? head=creat();//?????? print(head);//?????? }
31
15434
struct stu { char no[20],sx,nm[30],rm[20],mk[10]; int age; struct stu* next; }; main() { struct stu *p1,*p2,*head; int i; void output(struct stu *p,struct stu* p2); for(i=0;;i++) { p1=(struct stu*)malloc(L); if(i==0)head=p1; scanf("%s",p1->no); if(strcmp(p1->no,"end")==0)break; else { if(i==0)head=p1; scanf("%s %c%d%s%s",p1->nm,&p1->sx,&p1->age,p1->mk,p1->rm); if(i==0){head->next=NULL;p2=head;} else { p2->next=p1; p2=p1; p2->next=NULL;} } } output(head,head); } void output(struct stu* p,struct stu* p2) { if(p->next!=NULL)output(p->next,p2); printf("%s %s %c %d %s %s",p->no,p->nm,p->sx,p->age,p->mk,p->rm); if(p!=p2)printf("\n"); }
31
15435
/* ????? ?????????????????????????? ???????????????????????? ????????????????????????????????????????????????????? */ //???struct Student??????????????? typedef struct Stu{ char stu_id[20]; //?? char name[20]; //?? char gender; //?? int age; //?? char score[20]; //?? char address[50]; //?? struct Student* next; //??? struct Student* prev; //??? }Student; int main() { char start[50]; Student* head = NULL; //?????????? Student* tail = NULL; //?????????? //????????????? while(scanf("%s",start)) //????????????? { if(strcmp(start,"end") != 0) //?????????end, ????????????????????????????????? { Student *stu = (Student*)malloc(sizeof(Student)); //?????????????? strcpy(stu->stu_id,start); //????? if(scanf(" %s %c %d %s %s",stu->name,&stu->gender,&stu->age,stu->score,stu->address)) //?????? { //????????????????? stu->next = NULL; stu->prev = NULL; if(head == NULL) //?????????????????head????tail??? { head = stu; tail = stu; } else //????????????????????tail?next??????????????tail, ????tail??? { tail->next = stu; stu->prev = tail; tail = tail->next; } } } else // ???????????end, ????? break; } //?????????????????????? while(tail != NULL) { printf("%s %s %c %d %s %s\n",tail->stu_id,tail->name,tail->gender,tail->age,tail->score,tail->address); //?????? head = tail; tail = tail->prev; //??????????? free(head); } return 0; }
31
15436
struct stdnt { char num[20]; char name[20]; char gndr; int age; double score; char adrs[30]; struct stdnt* next; }; int n; struct stdnt *creat() { struct stdnt *p1,*p2=0; p1=(struct stdnt*)malloc(LEN); for (n=0;;n++) { if (n==0) p1->next=0; scanf("%s",p1->num); if (strcmp(p1->num,"end")==0) break; else p2=p1; scanf("%s %c%d%lf %s",p1->name,&p1->gndr,&p1->age,&p1->score,p1->adrs); p1=(struct stdnt*)malloc(LEN); p1->next=p2; } return p1->next; } void output(struct stdnt* p) { while (p!=0) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->gndr,p->age,p->score,p->adrs); p=p->next; } } int main() { struct stdnt *p; p=creat(); output(p); }
31
15437
struct student {char num[20]; char name[20]; char sex; int age; char grade[20]; char address[20]; struct student *next; }; int n; struct student *create(void) { struct student *head; struct student *p1,*p2; p1=p2=(struct student*)malloc(LEN); scanf("%s %s %c %d %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->grade,&p1->address); for(n=0;p1->sex=='f' || p1->sex=='m' ;n++) { if(n==0) p1->next=NULL; else p1->next=p2; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s %s %c %d %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->grade,&p1->address); } head=p2; return(head); } void print(struct student *head) { struct student *p; if (head!=NULL) for (p=head;p!=NULL;p=p->next) printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address); } void main() { struct student *head; head=create(); print(head); }
31
15438
/*?? ?? ?? ?? ?? ??*/ struct student { struct student *pre; char num[100]; char name[20]; char sex[2]; char age[10]; char score[10]; char ad[100]; struct student *next; }; 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; p2=p1; } else p1->pre=p2; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); } end=p2; p=end; 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
15439
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
15440
struct stu { char xuehao[20]; char xingming[30]; char xingbie; int nianling; char defen[10]; char dizhi[20]; struct stu *last; }; main() { struct stu a[10000],*p; int i=0; a[0].last=NULL; for(;;i++) { scanf("%s",a[i].xuehao); if(a[i].xuehao[0]=='e') break; scanf("%s %c %d %s %s",a[i].xingming,&a[i].xingbie,&a[i].nianling,a[i].defen,a[i].dizhi); if(i>0) { a[i].last=a+i-1; } p=(a+i); } while(p!=NULL) { printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->defen,p->dizhi); p=p->last; } }
31
15441
struct student {char num[10]; char name[20]; char sex; int age; char score[10]; char adr[30]; 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); scanf("%s",&p1->num); if (strcmp(p1->num,"end")==0){/*delete p1;*/break;} scanf(" %s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr); if(head==NULL)head=p1; else p1->previous=p2; p2=p1; } /*p1->previous=p2;*/ end=p2; p=end; if(end!=NULL) do {printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr); p=p->previous; }while(p!=NULL); }
31
15442
struct s{ char xuehao[20]; char xingming[20]; char xingbie; int age; char score[20]; char add[20]; struct s *next; }; int main(){ struct s *A(void); struct s *head,*p; head=A(); p=head; if(head!=NULL){ while(p->next!=NULL){ printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->age,p->score,p->add); p=p->next; } printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->age,p->score,p->add); } return 0; } struct s *A(void){ struct s *head,*p1,*p2; head=(struct s*)malloc(sizeof(struct s)); scanf("%s %s %c %d %s %s",head->xuehao,head->xingming,&head->xingbie,&head->age,head->score,head->add); head->next=NULL; p1=head; for(;;){ p2=(struct s*)malloc(sizeof(struct s)); scanf("%s",p2->xuehao); if(strcmp(p2->xuehao,"end")) scanf(" %s %c %d %s %s",p2->xingming,&p2->xingbie,&p2->age,p2->score,p2->add); else break; p2->next=p1; p1=p2; } p2->next=p1; return (p1); }
31
15443
struct student {char num[10]; char name[20]; char fm; int age; int score; char add[50]; struct student *next; }; int n; struct student *creat(void) {struct student *head; struct student *p1,*p2; 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) p1->next=NULL; else p1->next=p2;p2=p1;head=p2; p1=(struct student*)malloc(LEN); gets(p1->num); } return head; } int main() {struct student *head; struct student *p1,*p2; struct student *creat(void); head=creat(); void print (struct student *head); print(head); } void print (struct student *head) {struct student *p; p=head; if(head!=NULL) do {printf("%s\n",p->num); p=p->next;}while (p!=NULL); }
31
15444
struct student { char c[60]; struct student *next; }; struct student *creat(void) { struct student *head,*p1; p1=(struct student *) malloc(LEN); head=p1; head->next=NULL; gets(p1->c); while(strcmp(p1->c,"end")) { p1=(struct student *) malloc(LEN); gets(p1->c); p1->next=head; head=p1; } return(head); } void print(struct student *head) { struct student *p=head->next; do{puts(p->c);p=p->next;}while(p->next!=NULL); puts(p->c); } void main() { struct student *p=creat(); print(p); }
31
15445
struct stu { char xh[20],mz[20],xb,dz[20],df[20]; int nl; }; int main() { struct stu a[10000]; int n=0,i; char str[4]="end",c; scanf("%s",a[0].xh); while(strcmp(a[n].xh,str)!=0) { scanf("%s",a[n].mz); c=getchar(); scanf("%c",&a[n].xb); scanf("%d",&a[n].nl); scanf("%s",&a[n].df); c=getchar(); scanf("%s",a[n].dz); c=getchar(); n++; scanf("%s",a[n].xh); c=getchar(); } for(i=n-1;i>=0;i--) printf("%s %s %c %d %s %s\n",a[i].xh,a[i].mz,a[i].xb,a[i].nl,a[i].df,a[i].dz); return 0; }
31
15446
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
15447
struct student //????? { char id[10]; char name[20]; char gender; int age; char score[10]; char address[20]; struct student *next, *up;//next?????????,up??????????????????? }; int main() { struct student *head, *tail, *p, *r,*q; p=r=head=(struct student *)malloc(len);//head??????? p->up=NULL;//??????up????null??????????up?????????????? do { scanf("%s",p->id); if(strcmp(p->id,"end")!=0)//???????end?????????? { scanf("%s %c %d %s %s",p->name,&p->gender,&p->age,p->score,p->address); p->next=r=(struct student *)malloc(len);//??????next???????up??????? r->up=p; p=r; } else { p->next=NULL;//?????? tail=p->up;//?tail????????????????up??????????? break; } }while(1); q=tail; do { printf("%s %s %c %d %s %s\n",q->id,q->name,q->gender,q->age,q->score,q->address);//?up????? q=q->up; }while(q!=NULL); return 0; }
31
15448
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
15449
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
15450
struct student { char num[30];//???????end??strcpy?? char name[30]; char sex; int age; char score[30];//??????????? char add[30]; struct student *next; }*p1,*p2;//??????????? int n;//???? struct student *creat(void) //???? { struct student *head=NULL; char temp[30]={"end"}; n=0; p1=p2=(struct student*)malloc(LEN);// ????? scanf("%s",p1->num); while(strcmp(p1->num,temp)!=0)//?????end??? { scanf(" %s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); n=n+1; if(n==1) head=p1;//???? else p2->next=p1; p2=p1; p1=(struct student*)malloc(LEN);// ????? scanf("%s",p1->num);//????????while?? } p2->next=NULL; return(head); } struct student*change(struct student *head)//???? { struct student *head1,*head2=NULL; do{ p2=NULL; p1=head; while(p1->next!=NULL)//?p1???? { p2=p1; p1=p1->next; } if(head2==NULL) { head2=p1;//????? head1=head2->next=p2; } head1=head1->next=p2;//???????? p2->next=NULL; }while(head->next!=NULL); return(head2); } void print(struct student *head)//?? { struct student *p1; p1=head; while(p1!=NULL) { printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->next; } printf("\n"); } int main() { struct student *head; head=creat(); head=change(head); print(head); return 0; }
31
15451
struct student { char _no[9]; char name[20]; char sex[1]; int age; float score; char add[20]; struct student *next; }; int n; void main() { int i; struct student *p1; struct student *p2; struct student *head; n=0; p1=p2=(struct student*)malloc(LEN); head=NULL; for(n=0;;) { n=n+1; p1=(struct student*)malloc(LEN); if(n==1) { p2->next=NULL; } { scanf("%s",p1->_no); if(p1->_no[0]!='e') { scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add); p1->next=p2; p2=p1; } else { head=p2; break; } } } p1=head; for(i=0;p1->next!=NULL;i++) { printf("%s %s %s %d %g %s\n",p1->_no,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->next; } }
31
15452
struct stu { char a[100]; struct stu * next; }; struct stu * create() { struct stu *head,*p1,*p2; p2=p1=(struct stu *) malloc (sizeof(struct stu)); gets(p1->a); p1->next=0; while(!(p1->a[0]==101&&p1->a[1]==110&&p1->a[2]==100)) { p1=(struct stu *) malloc (sizeof(struct stu)); gets(p1->a); p1->next=p2; p2=p1; } return p1->next; } void print (struct stu *p) { while(p!=0) { printf("%s\n",p->a); p=p->next; } } int main() { struct stu *p; p=create(); print(p); return 0; }
31
15453
struct student {char info[100]; struct student *next1; struct student *next2; }; int n,i; struct student *creat(void) { struct student *p1,*p2,*p3; n=0; p3=p2=p1=(struct student*)malloc(LEN); gets(p1->info); while(p1->info[0]!='e') { n+=1; if(n==1){p2->next1=p1; p2->next2=NULL;} else {p2->next1=p1; p2->next2=p3;} p3=p2; p1=(struct student *)malloc(LEN); gets(p1->info); p2=p1; } p3->next1=NULL; return p3; } void print(struct student *head) { struct student *p; p=head; if(head!=NULL) do{ printf("%s\n",p->info); p=p->next2; }while(p!=NULL); } int main() {struct student *top; top=creat(); print(top); }
31
15454
char str[]={"end"}; struct student { char num[100]; char name[100]; char sex; int age; char score[100000]; char add[100]; struct student *next; }; struct student *create() { struct student *head,*p1,*p2; p1=(struct student*)malloc(Len); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add); p1->next=NULL; p2=p1; p1=(struct student*)malloc(Len); for(;;) {scanf("%s",p1->num); if(!strcmp(p1->num,str)) break; else { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); p1->next=p2; p2=p1; p1=(struct student*)malloc(Len); } } head=p2;return(head); } void main() { struct student *p; p=create(); do {printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; }while(p!=NULL); }
31
15455
struct student { char a[100]; char b[100]; char c; int d; char e[100]; char f[100]; struct student *t; }k[1000]; int n; int main() { int i; struct student *head,*p; for(i=0;;i++) { scanf("%s",k[i].a); if(strcmp(k[i].a,"end")==0) break; scanf(" %s %c %d %s %s",k[i].b,&k[i].c,&k[i].d,k[i].e,k[i].f); if(i>0) k[i].t=&k[i-1]; if(i==0) k[i].t=NULL; } head=&k[i-1]; p=head; do{ printf("%s %s %c %d %s %s\n",p->a,p->b,p->c,p->d,p->e,p->f); p=p->t;} while(p!=NULL); return 0; }
31
15456
struct Student { char number[100]; char name[100]; char sex; int age; char score[20]; char address[100]; struct Student *next; struct Student *front; }; int n; void main() { struct Student*p1,*p2; struct Student*head; n=0; p1=p2=(struct Student*)malloc(LEN); scanf("%s %s %c%d%s%s",p1->number,p1->name,&p1->sex,&p1->age,p1->score,p1->address); p1->front=NULL; while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d') { n=n+1; if(n==1)head=p1; else { p2=p1; p1=(struct Student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address); p1->front=p2; } } while(p2!=NULL) { printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address); p2=p2->front; } }
31
15457
void main() { struct student { char stu[100]; struct student *next; struct student *prev; }*head,*p1,*p2,*p; int n; p1=p2=(struct student *)malloc(LEN); gets(p1->stu); p1->prev=NULL; while(strcmp(p1->stu,"end")!=0) { p1=(struct student*)malloc(LEN); p1->prev=p2; gets(p1->stu); p2->next=p1; p2=p1; } p2->next=NULL; p=p2; do { p=p->prev; printf("%s\n",p->stu); }while(p->prev!=NULL); }
31
15458
struct Student { char num[50]; char name[50]; char x; int age; float score; char ad[50]; struct Student *next; }; struct Student *create(void) { struct Student *head,*p1,*p2; int n=0; char end[5]="end\0"; p1=(struct Student*)malloc(LEN); p2=p1; scanf("%s",p1->num); scanf("%s %c%d%f%s",p1->name,&p1->x,&p1->age,&p1->score,p1->ad); head=NULL; for(;;) { n=n+1; if(n==1)head=p1; else p1->next=head; head=p1; p1=(struct Student*)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,end)==0)break; scanf("%s %c%d%f%s",p1->name,&p1->x,&p1->age,&p1->score,p1->ad); } p2->next=NULL; return(head); } void print(struct Student *head) { struct Student *p; p=head; while(p!=NULL) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->x,p->age,p->score,p->ad); p=p->next; }; } main() { struct Student *pt; pt=create(); print(pt); }
31
15459
void main() { struct student { char str[100]; struct student *before; struct student *next; }*head,*p1,*p2; p1=(struct student *)malloc(sizeof(struct student)); p1->before=NULL; head=p1; while(strcmp(p2->str,"end")!=0) { gets(p1->str); p2=p1; p1=(struct student*)malloc(sizeof(struct student)); p1->before=p2; p2->next=p1; } p2->next=NULL; p2=p2->before; do { printf("%s\n",p2->str); p2=p2->before; }while(p2->before!=NULL); printf("%s\n",p2->str); }
31
15460
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
15461
struct student { char num[10]; char name[20]; char sex; int age; char score[20]; char address[50]; struct student *next; }; void main() { struct student *p,*head,*q; p=(struct student*)calloc(1000,sizeof(struct student)); int i,k; for(i=0;;i++) { scanf("%s",p[i].num); if(p[i].num[0]=='e') break; scanf("%s %c %d %s %s",p[i].name,&p[i].sex,&p[i].age,p[i].score,p[i].address); } k=i-1; head=&p[k]; for(i=k;i>=1;i--) p[i].next=&p[i-1]; p[0].next=NULL; q=head; do { printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->address); q=q->next; } while(q!=NULL); }
31
15462
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
15463
main() { int doit(int a); doit(1); } int doit(int r) { char a[20],b[20],c[20],d[20],e[20],f[20]; scanf("%s",a); if (a[0]!='e') { scanf("%s",b);scanf("%s",c);scanf("%s",d);scanf("%s",e);scanf("%s",f); doit(1);} else return 0; printf("%s %s %s %s %s %s\n",a,b,c,d,e,f); }
31
15464
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
15465
main() { struct a { char s[100]; struct a *next; }; int len=sizeof(struct a),n=0; struct a *p1,*p2,*head,*p; p1=p2=(struct a *)malloc(len); head=NULL; gets(p1->s); while(strcmp(p1->s,"end")!=0) { n++; if(n==1) head=p1; else p1->next=p2; p2=p1; p1=(struct a *)malloc(len); gets(p1->s); } head->next=NULL; p=p2; if(head!=NULL) { do { puts(p->s); p=p->next; }while(p!=NULL); } }
31
15466
struct Student { char num[20]; char name[20]; char sex; int age; char score[20]; char add[20]; struct Student *next; }; int n; struct Student *creat() { struct Student *head,*p1,*p2; p1=p2=(struct Student *) malloc(LEN); scanf("%s",&p1->num); while(p1->num[0]!='e') { n++; scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add); if(n==1) p1->next=NULL; else { p1->next=p2; p2=p1; } p1=(struct Student *) malloc(LEN); scanf("%s",&p1->num); } head=p2; return head; } void print(struct Student *head) { struct Student *p; p=head; if(head!=NULL) do { printf("%s %s %c %d %s %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=creat(); print(head); }
31
15467
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
15468
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
15469
struct stru { struct stru *pre; char msg[200]; struct stru *next; }*head, *p,*q,*end; void creat() { char temp[200]; p=q=(struct stru *)malloc(LEN); head=p; head->pre=NULL; gets(p->msg); while(1) { gets(temp); if(strcmp(temp,"end")!=0) {p=(struct stru *)malloc(LEN); strcpy(p->msg,temp); p->pre=q; q->next=p; q=p;} else break; } q->next=NULL; end=q; } void print(struct stru *end) { for(p=end;p!=NULL;p=p->pre) printf("%s\n",p->msg); } void main() { creat(); print(end); }
31
15470
struct student { char id[20]; char name[20]; char sex; int age; char score[20]; char address[20]; struct student *next; struct student *pre; }; struct student *create(void) { struct student *head,*p1,*p2,*end; p1=(struct student *)malloc(LEN); scanf("%s %s %c %d %s %s",p1->id,p1->name,&p1->sex,&p1->age,p1->score,p1->address); p1->next=NULL; p1->pre=NULL; head=p1; p2=p1; do { p1=(struct student*)malloc(LEN); scanf("%s",p1->id); if(strcmp("end",p1->id)==0) { break; } else { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); p1->next=NULL; p1->pre=NULL; p2->next=p1; p1->pre=p2; p2=p1; } }while(1); end=p2; 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->pre; } } int main() { struct student *end; end=create(); print(end); }
31
15471
int n; struct student { char str[100]; struct student *pre; } *p1, *p2; struct student *create(void) { struct student *last, *head; p1 = p2 = (struct student *)malloc(sizeof(struct student)); //???? gets(p1->str);//????? head=NULL; n=0; while (strcmp(p1->str,"end")!=0) { n=n+1; //?????? if (n==1) { head=p1; p1->pre = NULL;//??????pre?? } else { p1->pre = p2;//????pre???????? } p2 = p1;//????? p1 = (struct student *)malloc(sizeof(struct student));//???? gets(p1->str); } last=p1->pre=p2; return (last); } void main () { struct student *create(); struct student *last, *p; last=create(); p=last; do { printf("%s\n", p->str); p=p->pre; } while (p->pre!=NULL); if(p->pre==NULL) printf("%s\n", p->str); }
31
15472
struct stu { char num[10]; char name[20]; char sex; int age; float mark[6]; char add[10]; struct stu *next; }; int n; struct stu *creat(void) { struct stu *head; struct stu *p1,*p2; n=0; p1=p2=(struct stu *)malloc(sizeof(struct stu)); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) { free(p1); head=NULL; return head; } else { scanf(A,p1->name,&p1->sex,&p1->age,p1->mark,p1->add); head=p1; p2=p1; p1->next=NULL; do { p1=(struct stu *)malloc(sizeof(struct stu)); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) { free(p1); break; } else { scanf(A,p1->name,&p1->sex,&p1->age,p1->mark,p1->add); head=p1; p1->next=p2; p2=p1; } }while(1); return head; } } int main(void) { struct stu *p; struct stu *head; p=creat(); while(p) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add); p=p->next; } }
31
15473
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
15474
struct student { char xuehao[20]; char name[30]; char sex; int age; char score[20]; char adress[40]; struct student *next; }; void insert (struct student *pheader) { struct student *p; p=(struct student *)malloc(sizeof(struct student)); p->next=pheader->next; pheader->next=p; } main() { struct student *pheader,*p; pheader=(struct student *)malloc(sizeof(struct student)); pheader->next=NULL; while(9) { insert(pheader); scanf("%s",pheader->next->xuehao); if(pheader->next->xuehao[0]=='e') break; scanf("%s %c %d %s %s",pheader->next->name,&pheader->next->sex,&pheader->next->age,&pheader->next->score,pheader->next->adress); } p=pheader->next; while(9) { p=p->next; printf("%s %s %c %d %s %s\n",p->xuehao,p->name,p->sex,p->age,p->score,p->adress); if(p->next==NULL) break; } while(9){ if(pheader->next->next==NULL) break; p=pheader->next; pheader->next=p->next; free(p);} free(pheader->next); free(pheader); }
31
15475
int main() { char s[1000][100]; int i; for (i=0,gets(s[i]); s[i][0]!='e'; gets(s[i])) i++; for (i--;i!=-1; i--) puts(s[i]); return 0; }
31
15476
struct student { char str[50]; struct student *next; }; struct student *creat() { struct student *head=NULL,*p1,*p2; p1=p2=(struct student*)malloc(Len); gets(p1->str); while(strcmp(p1->str,"end")!=0) { if(head==NULL)head=p1; else p2->next=p1; p2=p1; p1=(struct student*)malloc(Len); gets(p1->str); } p2->next=NULL; return(head); } struct student *re(struct student *head) { struct student *p1,*p2,*newhead=NULL,*n; do {p1=head; p2=NULL; while(p1->next!=NULL)p2=p1,p1=p1->next; if(newhead==NULL)newhead=p1,n=newhead->next=p2; n=n->next=p2; p2->next=NULL; }while(head->next!=NULL); return(newhead); } 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(); head=re(head); print(head); }
31
15477
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
15478
typedef struct Student { char ALL[100]; struct Student *pNext; struct Student *pPrev; }Stu; int main(void) { Stu *pRoot=(Stu *)malloc(sizeof(Stu)); Stu *pNow=pRoot; pRoot->pPrev=NULL; for(;;) { gets(pNow->ALL); if(strcmp("end",pNow->ALL)) { pNow->pNext=(Stu *)malloc(sizeof(Stu)); pNow->pNext->pPrev=pNow; pNow=pNow->pNext; } else break; } pNow=pNow->pPrev; for(;;) { puts(pNow->ALL); if(pNow->pPrev==NULL) break; pNow=pNow->pPrev; } return 0; }
31
15479
struct Student { char num[20]; char name[20]; char sex; int age; char score[20]; char add[20]; struct Student *next; }; int n=0; struct Student*create() { struct Student*head; struct Student*p1,*p2; n=0; p1=p2=(struct Student*)malloc(sizeof(struct Student)); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add); 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(sizeof(struct Student)); scanf("%s",p1->num); if(strcmp(p1->num,"end")!=0) scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); } p2->next=NULL; return (head); } void print(struct Student *head) { struct Student*p; p=head; if(p->next!=NULL)print(p->next); printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); } int main() { struct Student *head; head=create(); print(head); return 0; } // //p=p->next;
31
15480
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(;p2->former!=NULL;) { if(p2->score==(int)(p2->score)) printf("%s %s %c %d %d %s\n",p2->num,p2->name,p2->sex,p2->age,(int)(p2->score),p2->address); else printf("%s %s %c %d %.1lf %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address); p2=p2->former; } // p1=p; // for(;p1->former!=NULL;) // { // p2=p1; // p1=p2->former; // free(p2); // } // free(p1); }
31
15481
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
15482
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
15483
struct node { char no[20],name[20],sex,ad[20],score[20]; int age; struct node *next; }*start=NULL,*p; int main() { struct node * temp; while(1==1) { temp=(struct node *)malloc(sizeof(struct node)); scanf("%s",temp->no); if(strcmp(temp->no,"end")==0) break; scanf(" %s %c %d %s %s",temp->name,&temp->sex,&temp->age,temp->score,temp->ad); temp->next=start; start=temp; } p=start; while(p!=NULL) { printf("%s %s %c %d %s %s\n",p->no,p->name,p->sex,p->age,p->score,p->ad); p=p->next; } printf("\n"); return 0; }
31
15484
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
15485
struct student { char id[100]; char name[100]; char sex; int age; char score[100000]; char address[100]; struct student *next; }; struct student *creat(void) { struct student *head,*p,*q; q=NULL; head=(struct student *)malloc(len); p=head; while(1) { q=p; scanf("%s",&p->id); if(strcmp(p->id,"end")==0) break; scanf("%s %c %d %s %s",&p->name,&p->sex,&p->age,&p->score,&p->address); p=(struct student *)malloc(len); q->next=p; } q->next=NULL; return (head); } struct student *turn(struct student *head) { struct student *p,*q,*t,*newhead=NULL; while(head->next !=NULL) { q=NULL; p=head; while(p->next!=NULL) { q=p; p=p->next; } if(newhead==NULL) { newhead=p; t=newhead->next=q; } t=t->next=q; q->next=NULL; } return newhead; } void put(struct student *head) { struct student *p; for(p=head;p!=NULL;p=p->next) { if(strcmp(p->id,"end")==0) continue; printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address); } } void main() { struct student *head; head=creat(); head=turn(head); put(head); }
31
15486
char a[3]={'e','n','d'}; struct student { char xuehao[50]; char name[50]; char gender; int age; float score; char add[100]; struct student *next; }; int m; struct student *head; struct student *creat() { struct student *p1,*p2; m=0; p1=p2=(struct student*)malloc(LEN); scanf("%s %s %c %d %f %s",p1->xuehao,p1->name,&p1->gender,&p1->age,&p1->score,p1->add); head=NULL; while(strcmp(p1->xuehao,a)!=0) { m=m+1; if(m==1) {p2->next=NULL;} else p1->next=p2; p2=p1; head=p1; p1=(struct student*)malloc(LEN); scanf("%s",p1->xuehao); if(strcmp(p1->xuehao,a)!=0) {scanf(" %s %c %d %f %s",p1->name,&p1->gender,&p1->age,&p1->score,p1->add);} } if(strcmp(p1->xuehao,a)==0) p1->next=head; return(head); } void main() { creat(); struct student *p1; for(p1=head;p1!=NULL;p1=p1->next) printf("%s %s %c %d %g %s\n",p1->xuehao,p1->name,p1->gender,p1->age,p1->score,p1->add); }
31
15487
struct student { char num[20]; char name[20]; char x[2]; int age; char score[8]; char add[30]; struct student *next; }; void main() { int i,j; struct student *head,*p1,*p2; p1=(struct student *)malloc(len); head=p1; scanf("%s%s%s%d%s%s",p1->num,p1->name,p1->x,&p1->age,p1->score,p1->add); p1->next=null; for(i=1;;i++) { p1=(struct student *)malloc(len); scanf("%s",p1->num); if((p1->num[0])!='e') { scanf("%s%s%d%s%s",p1->name,p1->x,&p1->age,p1->score,p1->add); p1->next=head; head=p1; } else break; } do { printf("%s %s %s %d %s %s\n",head->num,head->name,head->x,head->age,head->score,head->add); head=head->next; }while(head!=null); }
31
15488
struct stu {char id[16]; char name[32]; char gender; int age; char score[8]; char add[16]; struct stu*next; }; int n; struct stu*creat(void) {struct stu *head,*p1,*p2; n=0; head=NULL; p1=p2=(struct stu*)malloc(sizeof(struct stu)); scanf("%s",p1->id); while(strcmp(p1->id,"end")!=0) {scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->add); n=n+1; if(n==1) {head=p1;p1->next=NULL;} else { p1->next=p2; head=p1; } p2=p1; p1=(struct stu*)malloc(sizeof(struct stu)); scanf("%s",p1->id); } return(head); } void main() {struct stu*head,*p; head=creat(); p=head; if(head!=NULL) do {printf("%s %s %c %d %s %s\n",p->id,p->name,p->gender,p->age,p->score,p->add); p=p->next; }while(p!=NULL); }
31
15489
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
15490
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
15491
struct student { char num[15]; char name[30]; char sex; char age[3]; char grade[10]; char ad[15]; }stu[1000]={0}; int main() { int i=0; while(1) { scanf("%s",stu[i].num); if(stu[i].num[0]=='e') break; else { scanf("%s %c %s %s %s",stu[i].name,&stu[i].sex,stu[i].age,stu[i].grade,stu[i].ad); i++; } } i=i-1; for(;i>=0;i--) { printf("%s %s %c %s %s %s\n",stu[i].num,stu[i].name,stu[i].sex,stu[i].age,stu[i].grade,stu[i].ad); } return 0; }
31
15492
struct student { char info[50]; struct student *p; }; void main() { int m,n,i,j; struct student *p,*head; for(i=0;;i++) { p=DT; if(i==0) p->p=NULL; gets(p->info); if(strcmp(p->info,"end")==0) break; p->p=head; head=p; } for(p=head,j=0;j<i;j++,p=p->p) { puts(p->info); } }
31
15493
struct Student { char number[100]; char name[100]; char sex; int age; char score[20]; char address[100]; struct Student *next; struct Student *front; }; int n; void main() { struct Student*p1,*p2; n=0; p1=p2=(struct Student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address); p1->front=NULL; while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d') { n=n+1; p2->next=p1; p2=p1; p1=(struct Student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address); p1->front=p2; } p2->next=NULL; while(p2!=NULL) { printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address); p2=p2->front; } }
31
15494
struct a { char num[10]; char name[21]; char sex; int age; float score; char address[12]; struct a*next; }; struct a*create() { struct a*head,*p1; p1=len;p1->next=null;head=p1;strcpy(p1->num,"pp"); while(strcmp(p1->num,"end")) { scanf("%s",p1->num); if(strcmp(p1->num,"end")!=0) { scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address); p1=len; p1->next=head; head=p1; strcpy(p1->num,"pp");} } head=p1->next; return head; } void print(struct a*head) { struct a*p1; p1=head; do { printf("%s %s %c %d %g %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address); if(p1->next!=null)printf("\n"); p1=p1->next; }while(p1); } int main() { struct a*create(); struct a*head; void print(struct a*head); head=create(); print(head); }
31
15495
struct student {char number[100]; char name[100]; char sex; int age; char score[20]; char address[100]; struct student *next; struct student *front; }; void main() { struct student *p1,*p2; p1=p2=(struct student*)malloc(LEN); p1->front=NULL; scanf("%s",&p1->number); while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d') { scanf("%s %c%d%s%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address); p2->next=p1; p2=p1; p1=(struct student*)malloc(LEN); p1->front=p2; scanf("%s",&p1->number); } p2->next=NULL; while(p2!=NULL) { printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address); p2=p2->front; } }
31
15496
int main() { char str[10000][100]; gets(str[0]); int i=0,j; while(str[i][0]!='e') { i++; gets(str[i]); } for(j=i-1;j>=0;j--) printf("%s\n",str[j]); getchar();getchar(); }
31
15497
struct node { int num; char number[20]; char name[20]; char sex[10]; char age[10]; char score[10]; char address[20]; struct node *next; }; struct node * creat(int n); struct node * insert(struct node *head,struct node * q); void list(struct node *head); struct node * fv(struct node * head); int main(void) { struct node *p; p=creat(0); int i; for(i=1;i<1000;i++) { struct node *q; q=creat(i); if(strcmp("end",q->number)!=0) p=insert(p,q); else break; } p=fv(p); list(p); return 0; } struct node * creat(int n) { struct node *ps; ps=(struct node *)malloc(sizeof(struct node)); scanf("%s %s %s %s %s %s\n",&ps->number,&ps->name,&ps->age,&ps->sex,&ps->score,&ps->address); fflush(stdin); ps->num=n; return(ps); } struct node * insert(struct node *head,struct node * q) { struct node *m,*n; m=head; if(head==0) { head=q; q->next=0; } else { if(q->num<=head->num) { q->next=head; head=q; } else { while((q->num>m->num)&&(m->next!=0)) { n=m; m=m->next; } if(q->num<=m->num) { n->next=q; q->next=m; } else { m->next=q; q->next=0; } } } return(head); } struct node * fv(struct node * head) { struct node *p,*q,*k,*l; l=head; p=(struct node *)malloc(sizeof(struct node)); p->next=l; k=p->next; while(k!=0) { q=p; p=k; k=p->next; p->next=q; } p->next=q; q=p; while(q->num!=head->num) q=q->next; q->next=0; return(p); } void list(struct node *head) { struct node *p; p=head; while(p!=0) { printf("%s %s %s %s %s %s\n",&p->number,&p->name,&p->age,&p->sex,&p->score,&p->address); p=p->next; } }
31
15498
int n=0; struct student { char id[20]; char name[20]; char sex; int age; char score[20]; char address[20]; struct student* next; }; struct student *creat() { struct student* head,*pf,*ps; pf= (struct student * ) malloc(sizeof(struct student)); ps=pf; scanf("%s",&pf->id); while(pf->id[0]!='e') { n++; scanf("%s %c %d %s %s",&pf->name,&pf->sex,&pf->age,&pf->score,&pf->address); if(n!=1) { pf->next=ps; ps=pf; } else pf->next=NULL; pf=(struct student*)malloc(sizeof(struct student)); scanf("%s",&pf->id); } head=ps; return head; } void print(struct student *head) { int i; struct student *p; p=head; if(head!=NULL) for(i=0;i<n;i++) { printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address); p=p->next; } } void main() { struct student *head; head=creat(); print(head); }
31
15499
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; }