id
int32
0
32.5k
code
stringlengths
95
8.4k
label
stringclasses
65 values
15,000
struct st /*????????????*/ { char id[20]; char name[20]; char sex[2]; int age; char sco[20]; char ad[20]; struct st *next; }; main() { struct st *head,*p1,*p2,*p; p1 = p2 = (struct st*)malloc(len); /*???p1,p2?????????????*/ scanf("%s%s%s%d%s%s",p1->id,p1->name,p1->sex,&p1->age,p1->sco,p1->ad); p2->next = null; /*????????????????????*/ do /*??????*/ { p1 = (struct st*)malloc(len); /*???????*/ scanf("%s",p1->id); /*????????????‘id’???*/ if (strcmp(p1->id,"end") == 0) /*???‘end'???????*/ { break; } scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->sco,p1->ad); p1->next = p2; /*????????????*/ p2 = p1; /*?p2?????*/ } while (1); head = p2; /*?????????????????????*/ p = head; do /*???????????????????*/ { printf("%s %s %s %d %s %s\n",p->id,p->name,p->sex,p->age,p->sco,p->ad); p = p->next; /*???????????*/ } while(p != null); return 0; }
31
15,001
struct student { char id[100]; char name[100]; char sex; int age; char score[100]; char addr[100]; struct student *pre,*next; }; void main() { struct student *p1,*p2,*head1,*head2; int n=0; char temp[100]; head1=NULL; p1=p2=NULL; while(scanf("%s",temp),strcmp(temp,"end")!=0) { n=n+1; p1=(struct student *)malloc(sizeof(struct student)); p1->pre=NULL; p1->next=NULL; strcpy(p1->id,temp); scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr); if(n==1)head1=p1;else {p2->next=p1;p1->pre=p2;} p2=p1; } head2=p2; while(p2!=NULL) { printf("%s %s %c %d %s %s\n",p2->id,p2->name,p2->sex,p2->age,p2->score,p2->addr); p2=p2->pre; } }
31
15,002
struct Student { char ID[10]; char name[20]; char sex; int age; float score[20]; char add[20]; struct Student*next; }; int main() { struct Student a[1000],*head,*p; int i,j; for(i=0;;i++) { scanf("%s %s %c %d %s %s",a[i].ID,a[i].name,&a[i].sex,&a[i].age,a[i].score,a[i].add); if(a[i].ID[2]=='d') { printf("\n"); break; } } for(j=i-1;j>=0;j--) { head=&a[i-1]; a[j].next=&a[j-1]; a[0].next=NULL; p=head; } do { printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->add); p=p->next; }while(p!=NULL); return 0; }
31
15,003
char m[]="end"; struct student { char studen[100]; struct student *next; }; int n; struct student *creat(void) { struct student *head,*p1,*p2; n=0; p1=p2=(struct student *)malloc(sizeof(struct student)); gets(p1->studen); head=NULL; while(strcmp(p1->studen,m)!=0) { n=n+1; if(n==1)head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(sizeof(struct student)); gets(p1->studen); } p2->next=NULL; return(head); } void print(struct student *head) { struct student *p,*q; p=q=head;/*p,q???????????*/ while(p->next!=NULL) p=p->next;/*?p??????????????*/ printf("%s\n",p->studen); while(1) { while(q->next!=p) q=q->next; printf("%s\n",q->studen); p=q; q=head; if(p==head) break; } } int main() { struct student *ahead; ahead=creat(); print(ahead); }
31
15,004
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
15,005
struct student { char num[15]; char name[30]; char sex[2]; short age; float score; char address[30]; struct student *former; }; void main() { struct student *p1,*p2; p1=p2=(struct student *)malloc(LEN); scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->sex,&p1->age,&p1->score,p1->address); p1->former=NULL; while(1) { p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if (strcmp(p1->num,"end")==0) break; scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->address); p1->former=p2; p2=p1; } while (p2!=NULL) { printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address); p2=p2->former; } }
31
15,006
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
15,007
struct student { char num[20]; char name[20]; char sex; int age; char score[10]; char add[20]; struct student *next; }; int n=0; struct student *creat(void) { struct student *head,*p1,*p2; p1=p2=(struct student *)malloc(LEN); head=NULL; scanf("%s",p1->num); if(p1->num[0]=='e') return(head); scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); p1->next=NULL; while(p1->num[0]!='e') { n=n+1; head=p1; if(n>1) { p1->next=p2; p2=p1; } p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if(p1->num[0]=='e') break; scanf("%s %c %d %s %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) 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
15,008
struct student { char inf[100]; struct student*next; }; int n; struct student*creat(void) { struct student*head; struct student*p1,*end; n=0; p1=(struct student*) malloc(LEN); gets(p1->inf); head=end=NULL; while(strcmp(p1->inf,"end")!=0) { n=n+1; if(n==1) { p1->next=head; end=p1; } else {p1->next=end; end=p1;} p1=(struct student*) malloc(LEN); gets(p1->inf); } return end; } void print(struct student*end) { struct student *p1; p1=end; while(p1!=NULL) { printf("%s\n",p1->inf); p1=p1->next; } } void main() { struct student *end; end=creat(); print(end); }
31
15,009
struct student { char num[100]; struct student *pNext; }; int main() { int i,count=0; struct student a[1000],*pheader,*p; for(i=0;;i++) { gets(a[i].num); count++; if(strcmp(a[i].num,"end")==0) break; } pheader=&a[count-2]; for(i=count-2;i>=1;i--) { a[i].pNext=&a[i-1]; } a[0].pNext=NULL; p=pheader; while(p!=NULL) { puts(p->num); p=p->pNext; } }
31
15,010
struct Node { char Info[200]; struct Node *Next; }; int Insert(struct Node *Head) { struct Node *Tmp; Tmp=(struct Node *)malloc(sizeof(struct Node)); gets(Tmp->Info); if(strcmp(Tmp->Info,"end")==0) { free(Tmp); return 0; } else { Tmp->Next=Head->Next; Head->Next=Tmp; return 1; } } int main() { struct Node *Head,*Tmp; Head=(struct Node *)malloc(sizeof(struct Node)); Head->Next=NULL; while(Insert(Head)); Tmp=Head; while(Tmp->Next!=NULL) { Tmp=Tmp->Next; printf("%s\n",Tmp->Info); } return 1; }
31
15,011
struct student { char all[100]; struct student *next; }; struct student *creat(void) { struct student *head; struct student *p,*q; int t=0; head=(struct student*) malloc (sizeof (struct student)); gets(head->all); q=head; head->next=NULL; do { if(t>0) { p->next=q; q=p; } p=(struct student*) malloc (sizeof (struct student)); gets(p->all); t++; }while(strcmp(p->all,"end")!=0); return(q); } void print(struct student *head) { struct student *p; p=head; do { printf("%s\n",p->all); p=p->next; }while (p!=NULL); } void main() { struct student *headnew; headnew=creat(); print(headnew); }
31
15,012
struct stu {char info[50]; struct stu *next; }*p1,*p2; int n; struct stu *creat(void) {struct stu *head=NULL; n=0; p1=p2=(struct stu *)malloc(sizeof(struct stu));//??????? gets(p1->info); while(strcmp(p1->info,"end")!=0) {n++; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct stu *)malloc(sizeof(struct stu)); gets(p1->info); } p2->next=NULL; return (head); } struct stu * turnback(struct stu *head) { struct stu *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; } New=New->next=p2; p2->next=NULL; }while(head->next!=NULL); return(Newhead); } void output(struct stu *head) {for(p1=head;p1!=NULL;puts(p1->info),p1=p1->next); } void main() { struct stu *head; head=creat(); head=turnback(head); output(head); }
31
15,013
void main() { struct student { char info[1000]; struct student *pre,*next; } *head,*tail,*p; int l; l=sizeof(struct student); head=(struct student*)malloc(l); p=head; p->pre=NULL; p->next=NULL; for (;;) { gets(p->info); if (strcmp(p->info,"end")==0) {tail=p;break;} p->next=(struct student*)malloc(l); (p->next)->pre=p; (p->next)->next=NULL; p=p->next; } p=tail; for (;;) { if (!(p->pre)) {free(p);break;} puts((p->pre)->info); p=p->pre; free(p->next); } }
31
15,014
void main() { struct stu { char num[100]; char nam[100]; char sex; int age; float sco; char add[100]; struct stu *next; }; int len=1,i; struct stu *p1,*p2,*head,*new,*newhead; p1=p2=head=(struct stu *) malloc(sizeof(struct stu)); scanf("%s",p1->num); while(strcmp(p1->num,"end")!=0) { scanf("%s %c%d%f%s",p1->nam,&p1->sex,&p1->age,&p1->sco,p1->add); p1=(struct stu *) malloc(sizeof(struct stu)); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) p2->next=NULL; else { p2->next=p1; p2=p1; len++; } } p1=head; for(i=0;i<len;i++) { p2=p1=head; while(p1->next!=NULL) { p2=p1; p1=p1->next; } if(i==0) newhead=new=p1; else new=new->next=p1; p2->next=NULL; } p1=newhead; for(i=0;i<len;i++) { printf("%s %s %c %d %g %s\n",p1->num,p1->nam,p1->sex,p1->age,p1->sco,p1->add); p1=p1->next; } }
31
15,015
struct stu { char xuehao[100]; struct stu*next; }; void main() { int n=0; struct stu *head=NULL,*p1=NULL,*p2=NULL; p1=p2=(struct stu*)malloc(LEN); gets(p1->xuehao); while(strcmp(p1->xuehao,"end")!=0) { n++; if(n==1) { p1->next=NULL; } else p1->next=p2; p2=p1; p1=(struct stu*)malloc(LEN); gets(p1->xuehao); } while(p2->next!=NULL) { printf("%s\n",p2->xuehao); p2=p2->next; } printf("%s\n",p2->xuehao); }
31
15,016
struct student { char num[10]; char name[20]; char gender[2]; int year; char score[10]; char ad[20]; struct student *next; }; int main() { int i,count=0; struct student *head,*p1,*p2,*p,*q,*temp; for(i=1;i<=10000;i++){ p1=(struct student *)malloc(sizeof(struct student)); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0){ head=temp; break; } else if(i==1){ p1->next=NULL; p2=p1; temp=p1; } else{ p1->next=p2; p2=p1; temp=p1; } scanf("%s",p1->name); scanf("%s",p1->gender); scanf("%d",&p1->year); scanf("%s",p1->score); scanf("%s",p1->ad); count=count+1; } for(i=1;i<=count;i++){ if(i==1){ p=head; } printf("%s %s %s %d %s %s\n",p->num,p->name,p->gender,p->year,p->score,p->ad); p=p->next; if(p==NULL){ break; } } return 0; }
31
15,017
int n=0; struct student { char num[20]; char name[20]; char sex; char age[20]; char score[20]; char ad[20]; struct student *next; }; struct student *creat(void) { struct student *head; struct student *p1,*p2; p1=p2=(struct student *)malloc(LEN); head=NULL; scanf("%s ",p1->num); if(p1->num[0]=='e') return(head); scanf("%s %c %s %s %s",p1->name,&p1->sex,p1->age,p1->score,p1->ad); p1->next=NULL; for(;;) { n=n+1; head=p1; if(n>1) p1->next=p2; p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) { p1=NULL; break; } scanf("%s %c %s %s %s",p1->name,&p1->sex,p1->age,p1->score,p1->ad); } return(head); } void print(struct student *head) { struct student *p; p=head; if(head!=NULL) do { printf("%s %s %c %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad); p=p->next; }while(p!=NULL); } void main() { struct student *head; head=creat(); print(head); }
31
15,018
struct student { char name[32],sex,address[32],id[10],score[10]; int age; struct student *next; }; struct student *create() { struct student *head=NULL,*p1,*p2; char ch[10]; p1=p2=(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; head=p1; p2=p1; do { scanf("%s",ch); if(strcmp(ch,"end")==0) break; else { p1=(struct student*)malloc(Len); strcpy(p1->id,ch); scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address); p1->next=NULL; p2->next=p1; p2=p1; } }while(1); return head; } void print(struct student *head) { struct student *p1,*p2; while(p1) { p1=head; if(p1->next==NULL) { printf("%s %s %c %d %s %s",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->address); break; } else { while(p1->next!=NULL) { p2=p1; p1=p1->next; } printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->address); p2->next=NULL; free(p1); } } } int main() { struct student *head; head=create(); print(head); }
31
15,019
struct student { char a[100]; struct student *next; struct student *last; }; struct student *creat(void) { struct student *head,*p1,*p2; p1=(struct student *)malloc(sizeof(struct student)); gets(p1->a); p1->last=NULL; int i; for(i=1;strcmp(p1->a,"end")!=0;i++) { if(i==1); else {p2->next=p1;p1->last=p2;} p2=p1; p1=(struct student *)malloc(sizeof(struct student)); gets(p1->a); } p2->next=NULL;head=p2; return(head); } main() { struct student *head,*p; head=creat(); p=head; int i; for(i=0;p->last!=NULL;i++) { printf("%s\n",p->a); p=p->last; } printf("%s",p->a); }
31
15,020
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
15,021
struct stu{char id[20];char name[20];char sex;int age;char score[20];char address[20];struct stu *next;struct stu *former;}; struct stu *cr(void) {struct stu *head,*end; struct stu *p1,*p2; int i=0; p1=p2=(struct stu*)malloc(LEN); scanf("%s",&p1->id); if(strcmp(p1->id,"end")!=0) { scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);//printf("%s",p1->name); head=NULL; while(1) { i++; if(i==1) {head=p1;p1->former=NULL;} else {p2->next=p1;p1->former=p2;} p2=p1; p1=(struct stu*)malloc(LEN); scanf("%s",&p1->id); if(strcmp(p1->id,"end")==0)break; // printf("%s",p1->id); scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address); } p2->next=NULL; end=p2; return (end); } else return(NULL); } void print(struct stu *end) { struct stu *q=end; // printf("%s",end->id); while(q!=NULL&&end!=NULL) { printf("%s %s %c %d %s %s\n",q->id,q->name,q->sex,q->age,q->score,q->address); q=q->former;//printf("%s",q->id); } //printf("%s",q->id); } int main() {struct stu *p; p=cr(); print(p); return 0; }
31
15,022
struct student { char num[1000]; char name[1000]; char sex; int age; char score[1000]; char add[1000]; struct student*next; struct student*pre; }; int n; struct student*creat() { struct student*head,*end; struct student*p1,*p2; n=0; p1=p2=(struct student*)malloc(LEN); head=NULL; scanf("%s",p1->num); while(p1->num[0]!='e') { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); n=n+1; if(n==1){head=p1;p1->pre=NULL;} else {p2->next=p1;p1->pre=p2;} p2=p1; p1=(struct student*)malloc(LEN); scanf("%s",p1->num); } p2->next=NULL; end=p2; return(end); } void print(struct student*end) { struct student*p; p=end; do { printf("%s %s %c %d %s %s",p->num,p->name,p->sex,p->age,p->score,p->add); printf("\n"); p=p->pre; }while(p!=NULL); } int main() { struct student *end; end=creat(); print(end); return 0; }
31
15,023
struct student { char str[100]; struct student *next; }; int n; char end[5]="end"; struct student *creat(void) { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(LEN); gets(p1->str); head=null; while(strcmp(p1->str,end)!=0) { n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); gets(p1->str); } p2->next=null; return(head); } void main() { struct student *p1,*p2,*p3,*head; head=creat(); p1=head; p2=p1->next; p3=p2->next; while(p3!=null) { p2->next=p1; p1=p2; p2=p3; p3=p2->next; } p2->next=p1; head->next=null; do { printf("%s\n",p2->str); p2=p2->next; } while(p2!=null); }
31
15,024
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
15,025
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
15,026
struct student { char data[500]; struct student *former; }; int n; struct student *create() { struct student *tail; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(sizeof(struct student)); gets(p1->data); tail=NULL; while(strcmp(p1->data,"end")!=0) { n=n+1; if (n==1) { tail=p1; p1->former=NULL; } else { tail=p1; p1->former=p2; p2=p1; } p1=(struct student *)malloc(sizeof (struct student)); gets(p1->data); } return(tail); } int main() { struct student *p,*start; p=create(); start=p; if (p!=NULL) { do { puts(start->data); start=start->former; } while (start!=NULL); } }
31
15,027
struct Student { char num[20]; char name[20]; char sex; int age; char score[20]; char add[20]; struct Student *next; }; struct Student *creat() { int i; struct Student *head,*p1,*p2; p1=(struct Student *)malloc(LEN); scanf("%s",p1->num); for(i=0;p1->num[0]!='e';i++) { head=p1; scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add); if(i==0) p1->next=NULL; else p1->next=p2; p2=p1; p1=(struct Student *)malloc(LEN); scanf("%s",p1->num); } return head; } int main() { struct Student *head,*p; head=creat(); p=head; 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,028
struct student { char num[20]; char name[20]; char sex; int age; char score[20]; char address[20]; struct student*next; }; char t[4]={"end"}; struct student*p1,*p2; struct student * creat(void) //??????? { struct student*head; int n=0; p1=p2=(struct student*)malloc(LEN); scanf("%s", p1->num); while ( strcmp(p1->num,t)!=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(LEN); scanf("%s",p1->num); } p2->next = NULL; return(head); } struct student*order(struct student*head) //??????? { struct student*ben,*rehead=NULL; while(head->next!=NULL) { p2=NULL; p1=head; while(p1->next!=NULL) { p2=p1; p1=p1->next; } if(rehead==NULL) { rehead=p1; ben=rehead->next=p2; } ben=ben->next=p2; p2->next=NULL; }; return(rehead); } 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->address); p=p->next; }while(p!=NULL); } int main() { struct student*head; head=creat(); head=order(head); print(head); return 0; }
31
15,029
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
15,030
struct student { char number[30]; char name[20]; char sex; int age; char score[30]; char address[20]; struct student *next; }; main() { struct student *head,*end,*p,*q,*a; head=(struct student*)malloc(sizeof(struct student)); end=(struct student*)malloc(sizeof(struct student)); int i,n; end->next=NULL; a=head; for(i=1;;i++) { if(i==1) { p=(struct student*)malloc(sizeof(struct student)); scanf("%s",p->number); if(p->number[0]=='e') break; scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,p->score,p->address); head->next=p; p->next=end; q=p; } else { p=(struct student*)malloc(sizeof(struct student)); scanf("%s",p->number); if(p->number[0]=='e') break; scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,p->score,p->address); head->next=p; p->next=q; q=p; } } a=head->next; for(;a->next!=NULL;) { printf("%s %s %c %d %s %s\n",a->number,a->name,a->sex,a->age,a->score,a->address); a=a->next; } }
31
15,031
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
15,032
struct w {char id[100]; struct w *next; }; struct w *head,*new,*newhead,*p1,*p2; int i,n; struct w *create(void) { n=0; head=null; p1=p2=(struct w *)malloc(len); gets(p1->id); while(strcmp(p1->id,"end")!=0) { n++; if(n==1)head=p1; else p2->next=p1; p2=p1; p1=(struct w *)malloc(len); gets(p1->id); } p2->next=null; return head; } void main() { head=create(); for(i=0;i<n;i++) {p2=p1=head; while(p1->next!=null) {p2=p1;p1=p1->next;} if(i==0) newhead=new=p1; else new=new->next=p1; p2->next=null; } p1=newhead; for(i=0;i<n;i++) {printf("%s\n",p1->id); p1=p1->next; } }
31
15,033
int main() { struct joyan { char num[10]; char name[20]; char sex[1]; int age; float score; char add[20]; struct joyan * next; }; struct joyan *head,*p1,*p2; p1=p2=head=(struct joyan *)malloc(LEN); scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->sex,&p1->age,&p1->score,p1->add); p1->next = NULL; int n=1,i; while(p1->num[0]>='0'&&p1->num[0]<='9') { p1=(struct joyan *)malloc(LEN); scanf("%s",p1->num); if (p1->num[0]!='e') { scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add); p2->next=p1; p2=p1; n++; } else { p2->next=NULL; break; } } struct joyan *p,*q,*temp; p=head; if(p->next!=NULL) { q=p->next; if(q->next==NULL) { p->next=NULL; q->next=p; } else { p->next=NULL; temp=p; p=q; q=q->next; while(q->next!=NULL) { p->next=temp; temp=p; p=q; q=q->next; } p->next=temp; q->next=p; } head=q; } p1=head; for(i=0;i<n;i++) { printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add); p1=p1->next; } return 0; }
31
15,034
struct stu { char xinxi[100]; struct stu *down; }; int n=0; struct stu * creat() { struct stu *top=NULL; struct stu *p1=NULL,*p2=NULL; p1=p2=(struct stu *)malloc(LEN); gets(p1->xinxi); while(p1->xinxi[0]!='e') { n++; if(n==1) p1->down=NULL; else p1->down=p2; top=p1; p2=p1; p1=(struct stu *)malloc(LEN); gets(p1->xinxi); } return(top); } void main() { struct stu *top,*p; top=creat(); p=top; while(n!=0) {n--; puts(p->xinxi); p=p->down; } }
31
15,035
struct student { char con[50]; struct student *next; }; int n; struct student *creat(void) { struct student *head,*p,*q; n=0; p=q=(struct student *)malloc(len); gets(p->con); head=null; while(strcmp(p->con,"end")!=0) { //scanf("%s %c %d %d %s",p->name,&p->gender,&p->age,&p->score,p->add); n++; if(n==1)head=p,p->next=null; else head=p,p->next=q; q=p; p=(struct student *)malloc(len); gets(p->con); } return(head); } void print(struct student *head) { struct student *p; p=head; int i; for(i=0;i<n;i++) { printf("%s\n",p->con); p=p->next; } } void main() { struct student *head; head=creat(); print(head); }
31
15,036
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
15,037
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
15,038
struct student { char num[1000]; struct student *next; }; int n=0; struct student *creat() { struct student *head,*p1,*p2; p1=p2=(struct student*)malloc(LEN); gets(p1->num); 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; return (head); } struct student *reverse(struct student *head) { struct student *s,*s1; s=head; head=NULL; while(s) { s1=s; s=s->next; s1->next=head; head=s1; } return (head); } void print (struct student *head) { struct student *p; p=head; while (p!=NULL) { printf("%s\n",p->num); p=p->next; } } void main () { struct student *head; head=creat(); head=reverse(head); print(head); }
31
15,039
main() { int i,j,k,n,m; struct student { char num[200]; char name[200]; char sex; int age; char score[20]; char add[500]; }stu[1000]; i=0; while(1) { scanf("%s",stu[i].num); if(strcmp(stu[i].num,"end")==0) break; scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add); i++; } for(j=i-1;j>=0;j--) { printf("%s %s %c %d %s %s\n",stu[j].num,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add); } }
31
15,040
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
15,041
struct student { char str[100]; struct student *next; }; int isequal(char *a); int main() { struct student *head,*p1,*p2; p1=(struct student*)malloc(sizeof(struct student)); gets(p1->str); p1->next=NULL; if(isequal(p1->str)) { free(p1); head=NULL; } else { head=p1; p2=p1; do { p1=(struct student*)malloc(sizeof (struct student)); gets(p1->str); p1->next=NULL; if (isequal(p1->str)) { free(p1); break; } else { head=p1; p1->next=p2; p2=p1; } } while(1); } struct student *p; p=head; while(p) { printf("%s",p->str); p=p->next; if (p != NULL) printf("\n"); } return 0; } int isequal(char *a) { if (a[0] == 'e' && a[1] == 'n' && a[2] == 'd' && a[3] == 0) return 1; else return 0; }
31
15,042
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
15,043
struct sd {char xh[100];char xm[100];char xb;int nl;double df;char dz[10];struct sd*before;}; struct sd* cre() {struct sd *p1,*p2=NULL; while(1){p1=(struct sd*)(malloc(sizeof(struct sd))); scanf("%s",p1->xh); if(strcmp(p1->xh,"end")==0)break; else{ p1->before=p2;p2=p1; scanf("%s %c %d %lf %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz); }} return p2; } void main() {struct sd*cre(); struct sd*p=cre(); while(1){printf("%s %s %c %d %g %s\n",p->xh,p->xm,p->xb,p->nl,p->df,p->dz); if(p->before==NULL)break; else p=p->before; }}
31
15,044
struct student { char num[10]; char qita[50]; struct student *last; }; void main() { int l; struct student *end,*head,*p1,*p2; l=sizeof(struct student); end=(struct student*)malloc(l); head=(struct student*)malloc(l); scanf("%s",head->num); gets(head->qita); head->last=end; end->last=NULL; p1=head; p2=head; for(;;) { p1=(struct student*)malloc(l); scanf("%s",p1->num); if(p1->num[0]=='e') break; gets(p1->qita); p1->last=p2; p2=p1; } while(p2->last!=NULL) { printf("%s%s\n",p2->num,p2->qita); p2=p2->last; } }
31
15,045
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
15,046
struct stu { char num[15]; char name[20]; char sex; int year; char score[20]; char adr[15]; struct stu *next; }*p,*q,*head,*newhead,*ne; struct stu *creat(void) { char a[15]; head=null; scanf("%s",&a); while(strlen(a)!=3) { p=(struct stu *)malloc(l); strcpy(p->num,a); scanf("%s %c %d %s %s",p->name,&p->sex,&p->year,p->score,p->adr); if(head==null) q=head=p; else q=q->next=p; scanf("%s",a); } q->next=null; return (head); } struct stu * change(struct stu *head) { newhead=null; do { q=null; p=head; while(p->next!=null) { q=p; p=p->next; } if(newhead==null)newhead=p,ne=newhead->next=q; ne=ne->next=q; q->next=null; }while(head->next!=null); return (newhead); } void output(struct stu *newhead) { p=newhead; while(p!=null) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->adr); p=p->next; } } int main() { head=creat(); newhead=change(head); output(newhead); }
31
15,047
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
15,048
struct stu { char x[300]; struct stu *next; }; void creat1(struct stu *head,char *p) //????? { struct stu *pre,*p1,*s; s=(struct stu *)malloc(sizeof(struct stu)); strcpy(s->x,p); pre=head; p1=pre->next; pre->next=s; s->next=p1; } void creat2(struct stu *head,char *p) //????? { struct stu *pre,*p1,*s; s=(struct stu *)malloc(sizeof(struct stu)); strcpy(s->x,p); pre=head; p1=pre->next; for(;p1!=NULL;) { pre=p1; p1=p1->next; } pre->next=s; s->next=p1; } int main() { int i,j,k,m,n; char *p; p=(char *)malloc(300*sizeof(int)); struct stu *head,*s; head=(struct stu *)malloc(sizeof(struct stu)); head->next=NULL; for(i=0;;i++) { gets(p); if(*(p+0)=='e') { break; } else { creat1(head,p); } } s=head->next; for(;s!=NULL;) { puts(s->x); s=s->next; } return 0; }
31
15,049
/*?? ?? ?? ?? ?? ??*/ 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); } 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,050
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
15,051
struct student { char num[200]; char name[200]; char sex; int age; float score; char address[200]; struct student *next; }; int num; struct student *creat(void) { struct student *head; struct student *p1,*p2; head=NULL; num=0; while(1) { p1=(struct student *)malloc(LEN); scanf("%s",p1->num); if (strcmp(p1->num,"end")==0) { p2->next=NULL; return (head); 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++; } } } int main() { struct student *pt,*p,*pre; int i; pt=creat(); for (i=1;i<=num;i++) { for (p=pre=pt;p;p=p->next) { if (p->next!=NULL) pre=p; else { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); pre->next=NULL; } } } return 0; }
31
15,052
struct student { char num[20]; char name[40]; char sex[10]; int age; char score[20]; char addr[100]; struct student *next; }; main() { struct student *head,*p1,*p; int n=0; p1=( struct student*) malloc(LEN); scanf("%s%s%s%d%s%s",p1->num,p1->name,p1->sex,&p1->age,p1->score,p1->addr); head=NULL; while(strcmp(p1->num,"end")!=0) { n=n+1; if(n==1) {head=p1;p1->next=NULL;} else {p1->next=head;head=p1;} p1=(struct student*)malloc(LEN); scanf("%s%s%s%d%s%s",p1->num,p1->name,p1->sex,&p1->age,p1->score,p1->addr); } p=head; 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); }
31
15,053
struct stu_imformation { char num[16]; char name[20]; char sex; int age; char score[10]; char site[20]; struct stu_imformation *next; }; void main() { struct stu_imformation *head,*p1,*p2; head=(struct stu_imformation *)malloc(LEN); scanf("%s %s %c %d %s %s",head->num,head->name,&head->sex,&head->age,head->score,head->site); p2=head; head->next=NULL; p1=(struct stu_imformation *)malloc(LEN); scanf("%s",p1->num); while(strcmp(p1->num,"end")) { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->site); p1->next=p2; head=p1; p2=p1; p1=(struct stu_imformation *)malloc(LEN); scanf("%s",p1->num); } p1=head; while(p1!=NULL) { printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->site); p1=p1->next; } }
31
15,054
struct stud { char no[50]; char name[50]; char sex; int y; char sc[30]; char addr[50]; struct stud *pre; }; struct stud *creat() { struct stud *p1,*p2; char *g="end"; p1=p2=(struct stud *) malloc(LEN); p1->pre=NULL; scanf("%s",p1->no); while(strcmp(p1->no,g)) { scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->y,p1->sc,p1->addr); p2=p1; p1=(struct stud *) malloc(LEN);if(p1==NULL) return NULL; p1->pre=p2; scanf("%s",p1->no); } return (p1->pre); } void main() { struct stud *pt; pt=creat(); while(pt!=NULL) { printf("%s %s %c %d %s %s\n",pt->no,pt->name,pt->sex,pt->y,pt->sc,pt->addr); pt=pt->pre; } }
31
15,055
// 1209.cpp : Defines the entry point for the console application. // //#include "stdafx.h" struct data { char num[200],name[200],sex,add[200]; int age; char score[200]; struct data *next; }; struct data *creat() { struct data *head,*p1 = NULL,*p2 = NULL; int n=0; do{ p2=p1; p1=(struct data*)malloc(sizeof(struct data)); scanf("%s",p1->num); if(*p1->num=='e') { head=p2; free(p1); break; } scanf("%s %c %d %s %s\n",p1->name,&(p1->sex),&(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 data *head) { struct data *p; p=head; while(p) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; } } int main() { struct data *head; head=creat(); print(head); return 0; }
31
15,056
struct student { char num[20]; char name[20]; char gender; int age; char score[20]; char add[200]; struct student *prev; struct student *next;//???????????? }*head=0,*tail=0; void add_node(char*a,char*b,char c,int d,char* e,char* f) { if(head==0) { head=tail=(struct student*)malloc(sizeof(struct student));//??????? tail->next=tail->prev=0; } else { struct student *tmp=tail; tail=tail->next=(struct student*)malloc(sizeof(struct student)); tail->prev=tmp; tail->next=0; } strcpy(tail->num,a); strcpy(tail->name,b); strcpy(tail->add,f); strcpy(tail->score,e); tail->gender=c; tail->age=d; } void print()//???????? { while(tail) { printf("%s %s %c %d %s %s\n",tail->num,tail->name,tail->gender,tail->age,tail->score,tail->add); tail=tail->prev; } } int main() { char a[20]; char b[20]; char c; int d; char e[20]; char f[200]; scanf("%s",a); while(strcmp(a,"end")) { scanf("%s %c %d %s %s",b,&c,&d,e,f); add_node(a,b,c,d,e,f); scanf("%s",a); } print(); return 0; }
31
15,057
struct arr { char num[20]; char name[50]; char sex; int age; float score; char address[50]; struct arr *next; }; int n; struct arr *create(void) { struct arr *head; struct arr *p1,*p2; n=0; p1=p2=(struct arr *)malloc(LEN); scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&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 arr *)malloc(LEN); scanf("%s",&p1->num ); if(strcmp(p1->num,"end")==0)break; scanf("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address); } p2->next=NULL; return(head); } struct arr *reverse(struct arr *head) { struct arr *p1,*p2,*p3; p1=p2=head; if(p1!=NULL&&p1->next!=NULL) { p1=p1->next; p2->next=NULL; while(p1!=NULL&&p1->next!=NULL) { p3=p1; p1=p1->next; p3->next=p2; p2=p3; } head=p1; p1->next=p2; } return(head); } void print(struct arr *head) { int b; struct arr *p1; p1=head; while(p1!=NULL) { b=(int)p1->score; if(p1->score-b==0.0) printf("%s %s %c %d %d %s\n",p1->num,p1->name,p1->sex,p1->age,b,p1->address); else printf("%s %s %c %d %.1f %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address); p1=p1->next; } } void freelist(struct arr *head) { struct arr *p=head ; while(p!=NULL) { head=head->next; free(p); p=head; } } void main() { struct arr *head; head=create(); head=reverse(head); print(head); freelist(head); }
31
15,058
void main() { struct student { char num[10],name[20],sex,add[15]; int age; float mark; struct student * next; struct student * before; }; struct student *s1=(struct student *)malloc(sizeof(struct student)),*head=s1,*s2; (*s1).before=0; while(1) { scanf("%s",(*s1).num); if((*s1).num[0]!='e') { scanf("%s %c %d %f %s",(*s1).name,&((*s1).sex),&((*s1).age),&((*s1).mark),(*s1).add); s2=(*s1).next=(struct student *)malloc(sizeof(struct student)); (*s2).before=s1; s1=s2; } else { head=(*s1).before; break; } } s1=head; while(1) { printf("%s %s %c %d %g %s\n",(*s1).num,(*s1).name,(*s1).sex,(*s1).age,(*s1).mark,(*s1).add); if((*s1).before)s1=(*s1).before; else break; } }
31
15,059
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
15,060
struct stu { char num[40]; char name[40]; char sex[10]; char year[10]; char score[40]; char add[40]; struct stu *fw; struct stu *bw; }; int n; struct stu *tail; struct stu *create(void) { int i; struct stu *head,*p1,*p2; head=(struct stu *)malloc(sizeof(struct stu)); head->fw=NULL; head->bw=NULL; p2=head; while(1) { p1=(struct stu *)malloc(sizeof(struct stu)); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) { p1->fw=NULL; p2->fw=p1; p1->bw=p2; tail=p1; break; } else { scanf("%s %s %s %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add); p1->fw=NULL; p2->fw=p1; p1->bw=p2; p2=p1; } } return head; } void bwprint(struct stu *ptail) { struct stu *p; p=ptail->bw; while(p->bw!=NULL) { printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add); p=p->bw; } } main() { int k=0; stu *p1; struct stu *pheader; pheader=create(); bwprint(tail); }
31
15,061
struct student { char id[10]; char name[100]; char sex; int age; char score[100]; char adr[100]; struct student *next; }; int n=0; struct student *creat() { struct student *head,*p1,*p2; head=NULL; p1=p2=(struct student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr); while(p1->id[0]!='e') { n++; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr); } p2->next=NULL; return(head); } void print(struct student*head,int m) { struct student*p1; p1=head; if(head!=NULL) do { printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->adr); p1=p1->next; }while(p1!=NULL); } struct student *turnback(struct student *head) { struct student *p1,*p2,*news,*p; int i; for(i=n;i>=0;i--) {p2=p1=head; while(p1->next!=NULL) { p2=p1;p1=p1->next; } if(i==n) p=news=p1; else { p=p->next=p1; p2->next=NULL; } } return(news); } int main() { struct student*head,*newhead; head=creat(); newhead=turnback(head); print(newhead,n); getchar(); getchar(); getchar(); getchar(); }
31
15,062
struct student { char number[40]; char name[50]; char sex; int age; float score; char address[50]; struct student *next; }; int n; struct student *creat(void) { struct student *head,*p1,*p2; p1=p2=(struct student*)malloc(Len); head=NULL; scanf("%s%s %c%d%f%s",p1->number,p1->name,&(p1->sex),&(p1->age),&(p1->score),p1->address); n=0; while(1){ n++; if(n==1){ head=p1; }else{ p2->next=p1; } p2=p1; p1=(struct student*)malloc(Len); scanf("%s",p1->number); if(*p1->number=='e'){ break; } scanf("%s %c%d%f%s",p1->name,&(p1->sex),&(p1->age),&(p1->score),p1->address); } p2->next=NULL; return(head); } struct student *reverse(struct student *head) { struct student *p1,*p2,*p3; p1=head; p2=p1; p3=p1; do { if(p3==head){ p3=p2->next; p2=p3; p1->next=NULL; }else{ p3=p2->next; p2->next=p1; p1=p2; p2=p3; } }while(p3!=NULL); head=p1; return (head); } int main() { struct student *head; head=creat(); head=reverse(head); struct student *p1; p1=head; while(p1!=NULL){ printf("%s %s %c %d %g %s\n",p1->number,p1->name,p1->sex,p1->age,p1->score,p1->address); p1=p1->next; } return 0; }
31
15,063
struct student{ struct student * formal; char xuehao[20]; char xingming[20]; char xingbie; int nianling; char defen[20]; char dizhi[30]; struct student * next; }; int n=0; struct student * creat(void); void print(struct student *end); void main() { struct student * enda; enda=creat(); print(enda); return 0; } struct student * creat(void) { struct student * end; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(LEN); scanf("%s",p1->xuehao); while(p1->xuehao[0]!='e') { scanf("%s %c %d%s%s",p1->xingming,&p1->xingbie,&p1->nianling,p1->defen,p1->dizhi); n=n+1; if(n==1) { p1->formal=NULL; } else { p2->next=p1; p1->formal=p2; } p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->xuehao); } p2->next=NULL; end=p2; return(end); } void print(struct student *end) { struct student *p; p=end; if(end!=NULL) { do { printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->defen,p->dizhi); p=p->formal; }while(p!=NULL); } }
31
15,064
struct student { char num[30]; char name[20]; char a[3]; int age; char score[10]; char add[30]; struct student *next; }; int n; void *malloc(unsigned int size); void main() { int l=0,i=0; struct student *head,*p1,*p2,*newhead,*new1; n=0; p1=p2=(struct student*)malloc(LEN); scanf("%s%s%s%d%s%s",&p1->num,&p1->name,&p1->a,&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(LEN); scanf("%s%s%s%d%s%s",&p1->num,&p1->name,&p1->a,&p1->age,&p1->score,&p1->add); } p2->next=NULL; for(i=0;i<n;i++) { p2=p1=head; while(p1->next!=NULL) { p2=p1; p1=p1->next; } if(i==0) newhead=new1=p1; else new1=new1->next=p1; p2->next=NULL; } p1=newhead; for(l=0;l<n;l++) { printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->a,p1->age,p1->score,p1->add); p1=p1->next; } }
31
15,065
struct stu {char c[100]; struct stu *previous; }; int n; struct stu *creat(void) { struct stu *p,*q; n=0; p=q=(struct stu *)malloc(Len); gets(p->c); for(;strcmp(p->c,"end")!=0;) { n++; if(n==1) p->previous=Null; else { p=(struct stu *)malloc(Len); p->previous=q; q=p; gets(p->c); } } return(p); } void main() { struct stu *p; p=creat(); p=p->previous; for(;p!=Null;) { printf("%s\n",p->c); p=p->previous ; } }
31
15,066
struct student { char number[20]; char name[20]; char c; int age; float score; char address[30]; struct student *next; }; int n; struct student *creat(void) { struct student *head; struct student *p1,*p2; int m; n=0; p1=p2=(struct student*)malloc(LEN); head=NULL; scanf("%s",p1->number); for(m=0;;m++) { if(strcmp(p1->number,"end")!=0) { scanf("%s %c %d %f %s",p1->name,&p1->c,&p1->age,&p1->score,p1->address); n=n+1; if(n==1)head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); } else break; scanf("%s",p1->number); } p2->next=NULL; return(head); } struct student *del(struct student *head,char *str) { struct student *p1,*p2; p1=head; while(strcmp(str,p1->number)!=0&&p1->next!=NULL) { p2=p1; p1=p1->next; } if(strcmp(str,p1->number)==0) { if(p1==head)head=p1->next; else p2->next=p1->next; n=n-1; } return(head); } void main() { struct student *head,*p1; head=creat(); while(head!=NULL) { p1=head; while(p1->next!=NULL) p1=p1->next; printf("%s %s %c %d %g %s\n",p1->number,p1->name,p1->c,p1->age,p1->score,p1->address); head=del(head,p1->number); } }
31
15,067
struct student { char num[20]; char name[30]; char sex; int age; char score[20]; char add[40]; struct student *next; }; void main() { struct student *p1,*head; head=(struct student *)malloc(L); p1=head->next=NULL; scanf("%s",head->num); while(strcmp(head->num,"end")!=0) { p1=head; scanf(" %s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add); head=(struct student *)malloc(L); head->next=p1; scanf("%s",head->num); } free(head); head=p1; 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; } }
31
15,068
struct num {int nianling; float defen; char q[200],w[100],xingbie,xuehao[200]; struct num *next; }; struct num *crea() {long i; struct num *head; struct num *p1,*p2; p1=p2=(struct num *)malloc(LEN); head=p1; scanf("%s %s %c %d %f %s",&p1->xuehao,&p1->q,&p1->xingbie,&p1->nianling,&p1->defen,&p1->w); head->next=NULL; for(;;) { p1=(struct num *)malloc(LEN); scanf("%s",&p1->xuehao);if(p1->xuehao[0]!='e') {scanf("%s %c %d %f %s",&p1->q,&p1->xingbie,&p1->nianling,&p1->defen,&p1->w); p1->next=p2; p2=p1;} else {p1->next=p2,p2=p1;break;} } return(p1); } void main() { long nx,m,m0,tx,qx,q,mxh; struct num *hi,*p,*t; hi=crea(); t=hi->next; for(p=t;p!=NULL;p=p->next) {printf("%s %s %c %d %g %s\n",p->xuehao,p->q,p->xingbie,p->nianling,p->defen,p->w); } }
31
15,069
struct Student { char num[10]; char name[25]; char sex; int age; float score; char add[15]; struct Student *next; }; int main() { struct Student *creat(void); struct Student *head,*p; head=creat(); p=head; while(p->next!=NULL) { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; } printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); } struct Student *creat(void) { struct Student *head,*news; int i; head=NULL; for(i=0;;i++) { news=(struct Student *)malloc(sizeof(struct Student)); scanf("%s",news->num); if(news->num[0]=='e') break; scanf(" %s %c %d %f %s",news->name,&news->sex,&news->age,&news->score,news->add); news->next=head; head=news; } return(head); }
31
15,070
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
15,071
struct student { char num[10]; char name[20]; char c; int age; char score[10]; char addr[20]; struct student*next; }; void main() { struct student *p1,*p2,*p,*head; p1=(struct student*)malloc(LEN); scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->c,&p1->age,p1->score,p1->addr); p1->next=NULL; do { p2=(struct student*)malloc(LEN); scanf("%s",p2->num); if(strcmp(p2->num,"end")==0) { head=p1; break; } else { scanf("%s %c %d%s%s",p2->name,&p2->c,&p2->age,p2->score,p2->addr); p2->next=p1; p1=p2; } }while(strcmp(p2->num,"end")!=0); p=head; do { if(p->next==NULL) break; printf("%s %s %c %d %s %s\n",p->num,p->name,p->c,p->age,p->score,p->addr); if(p->next!=NULL) p=p->next; }while(p->next!=NULL); printf("%s %s %c %d %s %s\n",p->num,p->name,p->c,p->age,p->score,p->addr); }
31
15,072
struct student { char a[100]; struct student *pre; }; struct student *creat() { struct student *p1;struct student *p2; struct student *head; head=(struct student *) malloc(sizeof(struct student)); p1=p2=head; head->pre=0; while(1) { p1=(struct student *)malloc(sizeof(struct student)); p1->pre=p2; gets(p1->a); if(p1->a[0]=='e') { return (p2); } p2=p1; } } int main() { struct student *p1; p1=creat(); while(p1->pre!=0) { printf("%s\n",p1->a); p1=p1->pre; } return 0; } //?????????????????
31
15,073
struct student { char id[10]; char name[100]; char sex; int age; char score[100]; char adr[100]; struct student *next; }; int n=0; struct student *creat() { struct student *head,*p1,*p2; head=NULL; p1=p2=(struct student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr); while(p1->id[0]!='e') { n++; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student*)malloc(LEN); scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr); } p2->next=NULL; return(head); } void print(struct student*head,int m) { struct student*p1; p1=head; if(head!=NULL) do { printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->adr); p1=p1->next; }while(p1!=NULL); } struct student *turnback(struct student *head) { struct student *p1,*p2,*news,*p; int i; for(i=n;i>=0;i--) { p2=p1=head; while(p1->next!=NULL) { p2=p1;p1=p1->next; } if(i==n) p=news=p1; else { p=p->next=p1; p2->next=NULL; } } return(news); } int main() { struct student*head,*newhead; head=creat(); newhead=turnback(head); print(newhead,n); }
31
15,074
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
15,075
struct student { char id[20]; char name[20]; char sex; int age; char score[20]; char addr[20]; struct student *next; }; int n; struct student *head; struct student *creat(void) { struct student *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); scanf("%s",p1->id); } p2->next=NULL; return(head); } void main() { head=creat(); struct student *p,*p0; p=(struct student *)malloc(100*LEN); p0=(struct student *)malloc(LEN); p0=head; int i; for(i=0;i<n;i++,p++) { *p=*p0; p0=p0->next; } p--; printf("%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr); p--; for(i=1;i<n;i++,p--) printf("\n%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr); }
31
15,076
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
15,077
struct student {char c[300]; struct student *next; }; int n; struct student * create() {struct student *head,*p1,*p2; n=0; p1=p2=head=(struct student*)malloc(Len); gets(head->c); head->next=0; while (strcmp("end",p1->c)!=0) {head=p1; p1=(struct student*)malloc(Len); p1->next=head; gets(p1->c); } return head; } int main() { struct student *start; start=(struct student*)create(); do {printf("%s\n",start->c); start=start->next; }while (start->next!=0); printf("%s\n",start->c); return 7; }
31
15,078
struct student { char stuID[20]; char name[20]; char sex; int age; char score[10]; char add[20]; }; int main() { int i,j; struct student stu[5000]; scanf("%s %s %c %d %s %s",stu[0].stuID,stu[0].name,&stu[0].sex,&stu[0].age,stu[0].score,stu[0].add); i=0; if(strlen(stu[i].stuID)>=3) { while(1) { i++; scanf("%s",stu[i].stuID); if(strlen(stu[i].stuID)==3) break; scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add); } //printf("#####3"); for(j=i-1;j>=0;j--) { printf("%s %s %c %d %s %s\n",stu[j].stuID,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add); } } return 0; }
31
15,079
struct student { char id[50]; char name[50]; char sex; int age; double grade; char a[20]; struct student *next; }; void main() { struct student *h,*p,*q; int n=0; p=(struct student*)malloc(LEN); scanf("%s",p->id); while(p->id[0]!='e') { scanf("%s %c%d%lf%s",p->name,&p->sex,&p->age,&p->grade,p->a); n=n+1; if(n==1) p->next=NULL; else p->next=h; h=p; p=(struct student *)malloc(LEN); scanf("%s",p->id); } p=h; do { printf("%s %s %c %d %g %s\n",p->id,p->name,p->sex,p->age,p->grade,p->a); p=p->next; } while(p!=NULL); }
31
15,080
struct student {char number[100]; char name[100]; char sex; int age; char score[20]; char address[100]; struct student *nest; struct student *front; }; void main() { struct student *p1,*p2; int n=0; 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); n=n+1; p2->nest=p1; p2=p1; p1=(struct student*)malloc(LEN); p1->front=p2; scanf("%s",&p1->number); } p2->nest=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
15,081
struct stu { char num[20]; char name[20]; char sex; int age; char score[20]; char add[20]; struct stu *next; }; int main() { struct stu *p1,*p2,*head; p1=(struct stu*)malloc(sizeof(struct stu)); p1->next=NULL; p2=p1; p1=(struct stu*)malloc(sizeof(struct stu)); while(1) { scanf("%s",p1->num); if(p1->num[0]=='e') { head=p2; p1->next=p2; break; } scanf("%s %c %d %s %s",p1->name,&(p1->sex),&(p1->age),p1->score,p1->add); p1->next=p2; p2=p1; p1=(struct stu*)malloc(sizeof(struct stu)); } p1=head; 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; } return 0; }
31
15,082
struct stu {char num[9]; char nam[50]; char s; int old; double sco; char add[18]; struct stu *next; struct stu *abv; }; void main() {struct stu*head,*p1,*p2; int i=0; head=NULL; do {p1=(struct stu*)malloc(LEN); scanf("%s",&p1->num);if(!strcmp(p1->num,"end"))break; scanf("%s %c %d %lf %s",&p1->nam,&p1->s,&p1->old,&p1->sco,&p1->add); if(i==0){head=p1;p1->abv=NULL;} else {p1->abv=p2;} p2=p1; i++; }while(1); p1=p2; do {if(p1->sco-(int)p1->sco==0) printf("%s %s %c %d %.0lf %s\n",p1->num,p1->nam,p1->s,p1->old,p1->sco,p1->add); else printf("%s %s %c %d %.1lf %s\n",p1->num,p1->nam,p1->s,p1->old,p1->sco,p1->add); p1=p1->abv; }while(p1!=NULL); }
31
15,083
struct student { char num[30]; char name[50]; char sex; int age; float score; char addr[100]; struct student *next; struct student *pre; }; int n; struct student *end; struct student *creat() { struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(sizeof(struct student)); scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr); head=0; p1->pre=0; for(;strcmp(p1->num,"end")!=0;) { n++; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(sizeof(struct student)); p1->pre=p2; scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr); } p2->next=0; end=p2; return head; } void backprint(struct student *head,struct student *end) { struct student *p; p=end; if(n==0) printf("1\n"); else if(end!=0) for(;p!=0;) { printf("%s %s %c %d %g %s",p->num,p->name,p->sex,p->age,p->score,p->addr); printf("\n"); p=p->pre; } } void main() { struct student *head; head=creat(); backprint(head,end); }
31
15,084
struct stu { char num[500]; char name[500]; char sex[2]; char age[100]; char score[100]; char add[500]; struct stu *next; }; int n; struct stu *tj(void) { struct stu *head; struct stu *p1,*p2; n=0; p2=p1=(struct stu*)malloc(LEN); scanf("%s %s %s %s %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add); head=NULL; while(1) { n=n+1; if(n==1) head=p1; else p1->next=p2; p2=p1; p1=(struct stu*)malloc(LEN); scanf("%s",&p1->num); if(strcmp(p1->num,"end")==0) break; scanf("%s %s %s %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add); } head=p2; return(head); } void print(struct stu *head) { struct stu *p; p=head; while(p!=NULL) { printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add); p=p->next; } } void main() { struct stu *z; z=tj(); print(z); }
31
15,085
struct student { char num[50]; char name[50]; char sex[1]; int age; float score; char address[50]; struct student *next; }; void main() { struct student *head,*p1,*p2; p1=p2=(struct student*)malloc(sizeof(struct student)); head=p1; scanf("%s%s%s%d%f%s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->address); p2->next=NULL; while(strcmp(p1->num,"end")!=0) { p1=(struct student*)malloc(sizeof(struct student)); scanf("%s",p1->num); if(strcmp(p1->num,"end")==0) break; scanf("%s%s%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address); p2=p1; p2->next=head; head=p1; } p2=head; while(p2!=NULL) { printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address); p2=p2->next; } }
31
15,086
struct student { char inf[1000]; struct student *pNext; }; int main() { int i,j,k,l,m,n; int count=0; struct student a[1000],*pHeader,*p; for(i=0;;i++) { gets(a[i].inf); count=count+1; if(strcmp(a[i].inf,"end")==0) break; } pHeader=&a[count-2]; for(i=count-2;i>=1;i--) { a[i].pNext=&a[i-1]; } a[0].pNext=NULL; p=pHeader; while(p!=NULL) { puts(p->inf); p=p->pNext; } }
31
15,087
//#define NULL 0 struct student { char num[20]; char name[20]; char sex; int age; char score[10]; char adress[20]; // struct student *next; struct student *before; }; struct student *creat(void) { struct student *head,*p1,*p2; int n; n=0; p1=p2=(struct student *)malloc(LEN); // scanf("%s %s %c %d %d %s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->adress); 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->adress); n++; if(n==1) { // head=p1; p1->before=NULL; } else { p1->before=p2; head=p1; } p2=p1; p1=(struct student *)malloc(LEN); scanf("%s",p1->num); /* if(strcmp(p1->num,"end")==0) break; else scanf(" %s %c %d %d %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->adress);*/ } // head=p2; return(head); } void main() { struct student *head,*q1; head=creat(); q1=head; if(head!=NULL) { while(q1!=NULL) { printf("%s %s %c %d %s %s\n",q1->num,q1->name,q1->sex,q1->age,q1->score,q1->adress); q1=q1->before; } // printf("%s %s %c %d %d %s\n",q1->num,q1->name,q1->sex,q1->age,q1->score,q1->adress); } }
31
15,088
struct student { char str[1000]; struct student *next; }; int main() { struct student *p,*pnew,*head,*p1; pnew=(struct student *)malloc(sizeof(struct student)); gets(pnew->str); pnew->next=NULL; if(strcmp(pnew->str,"end")==0) { free(pnew); head=NULL; } else { head=pnew; p=pnew; while(1) { pnew=(struct student *)malloc(sizeof(struct student)); gets(pnew->str); pnew->next=NULL; if(strcmp(pnew->str,"end")==0) { free(pnew); break; } else { head=pnew; pnew->next=p; p=pnew; } } } p1=head; while(p1) { printf("%s\n",p1->str); p1=p1->next; } return 0; }
31
15,089
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
15,090
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
15,091
struct student { char name[100]; struct student *next; }; int main() { struct student *head,*p1,*p2;int i=0,j=0,m=0,k=0,n; p1=(struct student *)malloc(Len); scanf("%s",p1->name); p1->next=NULL;head=p1; for(;strcmp(p1->name,"end")!=0;i++) { p2=p1; p1=(struct student*)malloc(Len); scanf("%s",p1->name); p1->next=NULL; p2->next=p1; p2=p1; } struct student *p; p=head; j=0;n=i/6; for(m=1;m<=n;m++) { p=head;j=0; while(p&&j!=i-6*m) { p=p->next; j++; } if(p&&(j==i-6*m)) { for(k=0;k<5;k++) { printf("%s ",p->name);p=p->next; } printf("%s",p->name); } printf("\n"); } }
31
15,092
struct student { char inf[1000]; struct student *pre,*next; }; void main() { struct student *head,*p1,*p2,*tail; int i,j,k; head=(struct student *)malloc(LEN); p1=head;p2=NULL; p1->pre=NULL;p1->next=NULL; for(;;) { gets(p1->inf); if (strcmp(p1->inf,"end")==0) {p1->pre=p2;tail=p2;break;} else { p1->pre=p2; p1->next=(struct student *)malloc(LEN); p2=p1;p1=p1->next;p1->next=NULL; } } p1=tail; while (p1) { puts(p1->inf); p1=p1->pre; } }
31
15,093
struct stu { char num[100]; char name[100]; char sex[10]; int age; char score[100]; char add[100]; struct stu *before; }; void main() { struct stu *p2; struct stu * f(); p2=f(); while (p2!=0) { printf("%s %s %s %d %s %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->add); p2=p2->before; } } struct stu * f() { struct stu *p1,*p2; p1=(struct stu *)malloc(sizeof (struct stu)); p2=p1; scanf("%s",p1->num); p1->before=0; if (strcmp(p1->num,"end")!=0) { do { p2=p1; scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->add); p1=(struct stu *)malloc(sizeof (struct stu)); p1->before=p2; scanf("%s",p1->num); } while (strcmp(p1->num,"end")!=0); } return p2; }
31
15,094
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 *head,*p,*q,*t; t=(struct student*)malloc(sizeof(struct student)); t->next=NULL; head=(struct student*)malloc(sizeof(struct student)); head->next=NULL; int i; for(i=0;;i++) { p=head->next; q=(struct student*)malloc(sizeof(struct student)); q->next=NULL; scanf("%s",q->num); if(q->num[0]=='e') break; scanf("%s %c %d %s %s",q->name,&q->sex,&q->age,q->score,q->address); t->next=p; head->next=q; q->next=p; } head->next=p; while(p!=NULL) { printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); p=p->next; } }
31
15,095
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
15,096
main() { char a[2000][20],b[2000][20],c[2000][20],d[2000][20],e[2000][20],s[2000][20]; int i=0,j; scanf("%s",a[i]); while(1) { scanf("%s",b[i]); scanf("%s",c[i]); scanf("%s",e[i]); scanf("%s",s[i]); scanf("%s",d[i]); i++; scanf("%s",a[i]); if(a[i][0]=='e') break; } for(j=i-1;j>=0;j--) { printf("%s %s %s %s %s %s\n",a[j],b[j],c[j],e[j],s[j],d[j]); } }
31
15,097
struct student { char num[10]; char name[20]; char sex; int age; float score; char adr[15]; struct student *last; }; char str[]="end"; int n=0; void print(struct student *head) { struct student *p; p=head; if(head!=NULL) do { printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr); p=p->last; }while(p!=NULL); } void main() { struct student *creat(void); void print(struct student *head); struct student *head; head=creat(); print(head); } struct student *creat() { struct student *head; struct student *p1,*p2; p1=p2=(struct student*)malloc(LEN); scanf("%s",&p1->num); head=NULL; while(strcmp(p1->num,str)!=0) { scanf("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr); if(n==0){p1->last=NULL;n=1;} else {p1->last=p2;} p2=p1; p1=(struct student*)malloc(LEN); scanf("%s",&p1->num); } head=p2; return(head); }
31
15,098
struct aa { char data[100]; struct aa* next; }; void print(struct aa* p) { if (p->next!=NULL) print(p->next); cout <<p->data<<endl; } int main() { struct aa *head,*p,*q; int si=sizeof(struct aa); head=(struct aa*)malloc(si); p=head;q=head; char s[100]; while (cin.getline(s,100)) if (strcmp(s,"end")) { q=(struct aa*)malloc(si); p->next=q; strcpy(q->data,s); q->next=NULL; p=q; } else break; print(head->next); return 0; }
31
15,099
struct student { char input[500]; struct student *next; }; void main() { char c[500]; struct student *head; struct student *p1,*p; head=NULL; while(strcmp(gets(c),"end")!=0) { p1=(struct student *)malloc(LEN); strcpy(p1->input,c); p1->next=head; head=p1; } p=head; do { puts(p->input); p=p->next; putchar('\n'); }while(p!=NULL); }
31