id
int32 0
32.5k
| code
stringlengths 95
8.4k
| label
stringclasses 65
values |
---|---|---|
15,100 |
struct shuju
{
char xh[20];
char xm[20];
char sex;
int age;
char fen[10];
char dorm[20];
struct shuju * next;
};
struct shuju *create()
{
struct shuju *head,*p1,*p2;
p1=(struct shuju* )malloc(len);
scanf("%s %s %c %d %s %s",p1->xh,p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
p1->next=NULL;
while (1)
{
p2=p1;
p1=(struct shuju* )malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")==0) {free(p1);break;}
else
{scanf("%s %c %d %s %s",p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
p1->next=p2;}
}
head=p2;
return (head);
}
void print(struct shuju* head)
{
struct shuju* p;
p=head;
while (p->next!=NULL)
{
printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
p=p->next;}
printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
}
void main()
{
struct shuju *p;
p=create();
print(p);
}
|
31
|
15,101 |
struct stu
{
char num[20];
char name[20];
char s;
int age;
char point[10];
char adr[50];
struct stu *p;
};
void main()
{
struct stu *stu1=NULL;
int n=sizeof(struct stu);
stu1=(struct stu *) malloc(n);
struct stu *head=NULL,*curent=NULL;
stu1->p=NULL;
while(scanf("%s",stu1->num))
{
if((strcmp(stu1->num,"end"))==0)
break;
scanf("%s %c %d %s %s",stu1->name,&stu1->s,&stu1->age,&stu1->point,stu1->adr);
stu1->p=curent;
curent=stu1;
stu1=(struct stu*) malloc(n);
}
while(curent!=NULL)
{
printf("%s %s %c %d %s %s\n",curent->num,curent->name,curent->s,curent->age,curent->point,curent->adr);
stu1=curent;
curent=curent->p;
free(stu1);
}
}
|
31
|
15,102 |
struct student
{
char num[1000];
struct student *next;
};
int main()
{
struct student s[1000],*p,*pheader;
int i=0;
int n;
char ch;
for (i=0;;i++)
{
gets(s[i].num);
if (strcmp(s[i].num,"end")==0)
break;
}
n=i;
pheader=&s[n-1];
for (i=n-1;i>=1;i--)
{
s[i].next=&s[i-1];
}
s[0].next=NULL;
p=pheader;
while (p!=NULL)
{
puts(p->num);
p=p->next;
}
return 0;
}
|
31
|
15,103 |
struct student
{
char num[30];
char name[40];
char sex[2];
int age;
float score;
char add[50];
struct student *next;
};
int n;
struct student *creat()
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=( struct student * ) malloc(LEN);
scanf("%s",p1->num);
head=0;
while(strcmp(p1->num,"end")!=0)
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
n++;
if(n==1) p2->next=0;
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!=0)
do
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}while(p!=0);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,104 |
struct Student
{
struct Student *prev;
char number[30];
char name[30];
char gender;
int age;
double score;
char address[30];
};
int main()
{
struct Student a,*p;
scanf("%s%s %c%d%lf%s",a.number,a.name,&a.gender,&a.age,&a.score,a.address);
p=(struct Student *)malloc(LEN);
*p=a;
(*p).prev=NULL;
for(;1;)
{
scanf("%s",a.number);
if(a.number[0]=='e')
break;
scanf("%s %c%d%lf%s",a.name,&a.gender,&a.age,&a.score,a.address);
a.prev=p;
p=(struct Student *)malloc(LEN);
*p=a;
}
printf("%s %s %c %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
for(;(*p).prev!=NULL;)
{
p=p->prev;
printf("%s %s %c %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
}
return 0;
}
|
31
|
15,105 |
struct stu* create();
struct stu{
char text[100];
struct stu *prev;
};
int main()
{
struct stu *p;
p=create();
while (p){
printf("%s\n", p->text);
p = p->prev;
}
return 0;
}
struct stu* create(){
struct stu *p1,*p2,*start;
p1 = (struct stu *)malloc(sizeof(struct stu));
gets(p1->text);
if (p1->text == "end" ){
free(p1);
start = NULL;
return start; //?????
}
else{
p1->prev = NULL;
start = p1;
p2 = p1;
do{
p1 = (struct stu *)malloc(sizeof(struct stu));
start=p2;
gets(p1->text);
if ( strcmp(p1->text,"end")==0 ){
free(p1);
break;
}
else{
p1->prev = p2;
p2 = p1;
}
} while (1);
return start; //?????
}
}
|
31
|
15,106 |
struct student
{
char num[20],na[30],sex[2],sc[10],old[3],ad[20];
struct student *next;
};
int n;
void main()
{
struct student *head,*p1,*p2,*p;
n=0;
p1=p2=(struct student *)malloc(LEN);
head=NULL;
while(scanf("%s",p1->num),p1->num[0]!='e')
{
n=n+1;
head=p1;
if(n>1)
p1->next=p2;
else
p1->next=NULL;
p2=p1;
scanf("%s%s%s%s%s",p1->na,p1->sex,p1->old,p1->sc,p1->ad);
p1=(struct student *)malloc(LEN);
}
p=head;
while(p!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->na,p->sex,p->old,p->sc,p->ad);
p=p->next;
};
}
|
31
|
15,107 |
struct student
{
char num[16];
char a[64];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p,*q;
n=0;
p=q=(struct student *)malloc(len);
scanf("%s",p->num);
head=null;
while(strcmp(p->num,"end")!=0)
{
gets(p->a);
n++;
if(n==1)head=p,p->next=null;
else head=p,p->next=q;
q=p;
p=(struct student *)malloc(len);
scanf("%s",p->num);
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
int i;
for(i=0;i<n;i++)
{
printf("%s",p->num);
puts(p->a);
p=p->next;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,108 |
// ??????????.cpp : ??????????????
//
struct student
{
char info[100];
struct student *pre;
};
struct student *creat()
{
struct student *p1,*p2,*head;
p1=(struct student*)malloc(L);
gets(p1->info);
if(strcmp(p1->info,"end")==0)
{
return(NULL);
exit;
}
else
{
p2=NULL;
for(int i=1;;i++)
{
p1->pre=p2;
p2=p1;
p1=(struct student*)malloc(L);
gets(p1->info);
if(strcmp(p1->info,"end")==0) break;
}
p1->pre=p2;
head=p1->pre;
return(head);
}
}
int main()
{
struct student *p;
p=creat();
while(p!=NULL)
{
printf("%s\n",p->info);
p=p->pre;
};
return 0;
}
|
31
|
15,109 |
struct stud
{
char num[30];
char name[20];
char sex;
int age;
char score[10];
char address[30];
struct stud *next;
};
int main()
{
struct stud *head,*p1,*p2,*p;
int n=0;
p1=p2=(struct stud *)malloc(sizeof(struct stud));
scanf("%s",&p1->num);
if (strcmp(p1->num,"end")==0) return 0;
scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
head=Null;
while(1)
{
n++;
if (n==1) p1->next=Null;
else p1->next=p2;
p2=p1;
p1=(struct stud *)malloc(sizeof(struct stud));
scanf("%s",&p1->num);
if (strcmp(p1->num,"end")==0) break;
scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
}
head=p2;
p=head;
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);
return 0;
}
|
31
|
15,110 |
struct record
{
char stuinfo[50];
struct record *pnext;
};
int main()
{
record *stu,*head,*ptemp;
head=(struct record*)malloc(sizeof(struct record));
head->pnext=NULL;
ptemp=(struct record*)malloc(sizeof(struct record));
stu= (struct record*)malloc(sizeof(struct record));
gets(stu->stuinfo);
while(strcmp(stu->stuinfo, "end")){
if (head->pnext==NULL)
{
head->pnext=stu;
stu->pnext=NULL;
}
else
{
ptemp=head->pnext;
head->pnext=stu;
stu->pnext=ptemp;
}
stu= (struct record*)malloc(sizeof(struct record));
gets(stu->stuinfo);
}
ptemp=head;
while(ptemp->pnext!=NULL){
ptemp=ptemp->pnext;
printf("%s\n", ptemp->stuinfo);
}
return 0;
}
|
31
|
15,111 |
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
|
15,112 |
struct stu{
char num[20];
char name[20];
char gen;
int age;
float mark;
char add[20];
struct stu *next;
};
char end[4]="end";
int main()
{
struct stu *p1,*p2,t;
p1=p2=NULL;
while(scanf("%s",t.num),strcmp(t.num,end)!=0)
{
scanf("%s %c %d %g %s\n",t.name,&t.gen,&t.age,&t.mark,t.add);
p1=(struct stu *)malloc(LEN);
*p1=t;
p1->next=p2;
p2=p1;
}
while(p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->gen,p1->age,p1->mark,p1->add);
p1=p1->next;
}
}
|
31
|
15,113 |
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
|
15,114 |
struct student
{
char info[100];
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->info);
head=NULL;
while (strcmp(p1->info,"end")!=0)
{
n=n+1;
if (n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
gets (p1->info);
}
p2->next=NULL;
return (head);
}
void pri(struct student *head,int i)
{
int j;
struct student *p1,*p2;
p1=head;
for (j=1;j<i;j++)
{
p2=p1;
p1=p2->next;
}
puts (p1->info);
}
void main()
{
int i;
struct student *head,stu;
head=creat ();
for (i=n;i>0;i--)
pri(head,i);
}
|
31
|
15,115 |
void main()
{
struct stu
{
char num[20];
char name[20];
char sex;
int age;
float score;
char addr[20];
struct stu*next;
}*p1,*p2;
p1=malloc(sizeof(struct stu));
scanf("%s",p1->num);
if(*p1->num!='e')
{
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
p1->next=0;
for(;;)
{
p2=p1;
p1=malloc(sizeof(struct stu));
scanf("%s",p1->num);
if(*p1->num=='e')break;
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
p1->next=p2;
}
p1=p2;
for(;p1;p1=p1->next)printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
}
}
|
31
|
15,116 |
struct student
{
char num[100];
char name[100];
char sex[2];
int age;
char score[20];
char addr[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2=NULL;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if (strcmp(p1->num,"end")!=0)
{
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->addr);
p1->next=NULL;
p2=p1;
while (1)
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if (strcmp(p1->num,"end")==0)
break;
else
{
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->addr);
p1->next=p2;
p2=p1;
}
}
}
head=p2;
return(head);
}
void print(struct student *head)
{
struct student *p1;
p1=head;
while(p1!=NULL)
{
printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->next;
}
}
void main()
{
struct student *head=NULL;
head=creat();
print(head);
}
|
31
|
15,117 |
struct student
{char a[50];
struct student *prev;
};
void main()
{
void print(struct student *head);
int n=0;
struct student *head;
struct student *p1,*p2;
p1=head=(struct student *)malloc(len);/*???????*/
gets(p1->a);
p2=NULL;
while(strcmp(p1->a,"end")!=0)
{
n++;
if(n==1)
p2=p1;
else
p1->prev=head;
head=p1;
p1=(struct student *)malloc(len);
gets(p1->a);
}
p2->prev=NULL;
print(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
do
{
printf("%s\n",p->a);
p=p->prev;
}
while(p!=NULL);
}
|
31
|
15,118 |
//???
int main()
{
struct student
{
char id[200];
char name[200];
char sex;
int age;
double score;
char add[200];
}stu[1000];
int i=0;
while(cin>>stu[i].id)
{
if(strcmp(stu[i].id,"end")==0)
break;
else
cin>>stu[i].name>>stu[i].sex>>stu[i].age>>stu[i].score>>stu[i].add;
i++;
}
int j=i;
for(j=i-1;j>=0;j--)
{
cout<<stu[j].id<<' '<<stu[j].name<<' '<<stu[j].sex<<' '<<stu[j].age<<' '<<stu[j].score<<' '<<stu[j].add<<endl;
}
return 0;
}
|
31
|
15,119 |
struct student{
char name[100];
char ind[100];
char sex;
int age;
float score;
char dizhi[100];
struct student *next;
};//?? ?? ?? ?? ?? ??
int n;
struct student *creat()
{
struct student *p1,*p2;
n=0;
p1=(struct student *)malloc(LEN);
p2=(struct student *)malloc(LEN);
scanf("%s %s %c %d %f %s",&p1->ind,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->dizhi);
p1->next=0;
while(strcmp(p2->ind,"end")!=0)
{
n++;
if(n==1)scanf("%s %s %c %d %f %s",&p2->ind,&p2->name,&p2->sex,&p2->age,&p2->score,&p2->dizhi);
else scanf("%s %c %d %f %s",&p2->name,&p2->sex,&p2->age,&p2->score,&p2->dizhi);
p2->next=p1;
p1=p2;
p2=(struct student *)malloc(LEN);
scanf("%s",&p2->ind);
}
return p1;
}
void main()
{
struct student *wr;
wr=creat();
printf("%s %s %c %d %g %s\n",wr->ind,wr->name,wr->sex,wr->age,wr->score,wr->dizhi);
//printf("10630018 zouan m 20 10 28#46000\n");
while(wr->next!=0){
wr=wr->next;
printf("%s %s %c %d %g %s\n",wr->ind,wr->name,wr->sex,wr->age,wr->score,wr->dizhi);
}
}
|
31
|
15,120 |
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;
if(p==last)
printf("%s\n", p->str);
for( p=last;p=p->pre;printf("%s\n", p->str));
}
|
31
|
15,121 |
struct student
{
char inf[50];
struct student *next;
};
int main()
{
struct student *head,*p;
p=(struct student*)malloc(LEN);
gets(p->inf);
head=NULL;
while (p->inf[0]!='e')
{
p->next=head;
head=p;
p=(struct student*)malloc(LEN);
gets(p->inf);
}
p=head;
while(true)
{
printf("%s",p->inf);
p=p->next;
if (p==NULL) break;
else printf("\n");
}
return 0;
}
|
31
|
15,122 |
struct student
{
char stu[100];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p1,*p2,*toil;
n=0;
head=NULL;
p1=p2=(struct student*)malloc(LEN);
gets(p1->stu);
while(strcmp(p1->stu,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->stu);
}
toil=p2;
head->next=NULL;
return(toil);
}
void print(struct student *toil)
{
struct student *p;
p=toil;
if(toil!=NULL)
do
{
printf("%s\n",p->stu);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,123 |
struct student
{
char num[10];
char name[30];
char sex;
int age;
char score[10];
char address[20];
struct student *next;
};
struct student *creat()
{
struct student *head,*p;
head=(struct student*)malloc(Len);
scanf("%s",head->num);
if(strcmp(head->num,"end")==0) head=NULL;
else scanf("%s %c %d %s %s",head->name,&head->sex,&head->age,head->score,head->address);
head->next=NULL;
while(1)
{
p=head;
head=(struct student*)malloc(Len);
scanf("%s",head->num);
if(strcmp(head->num,"end")==0) {head=p;break;}
else scanf("%s %c %d %s %s",head->name,&head->sex,&head->age,head->score,head->address);
head->next=p;
}
return head;
}
void print(struct student *head)
{struct student *q;
q=head;
while(q){printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->address);
q=q->next;}
}
void main()
{
print(creat());
}
|
31
|
15,124 |
struct student
{
char information[100];
struct student *previous;
};
void main()
{
struct student *p1,*p2,*p;
p1=z;
p1->previous=NULL;
gets(p1->information);
do{
p2=z;//???p1,p2??????????????
p2->previous=p1;
p1=p2;
gets(p2->information);
} while(strcmp(p1->information,"end"));
p1=p1->previous;
for(p=p1;p;p=p->previous)
puts(p->information);
}
|
31
|
15,125 |
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,126 |
void append()
{
char str[50];
gets(str);
if (str[0] != 'e')
{
append();
puts(str);
}
}
void main()
{
append();
}
|
31
|
15,127 |
struct student
{
char xh[1000];
struct student *next;
struct student *last;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
p1=(struct student*)malloc(sizeof(struct student));
p2=p1;
gets(p1->xh);
head=NULL;
p1->last=NULL;
for(n=1;strcmp(p1->xh,"end")!=0;n++)
{
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(sizeof(struct student));
gets(p1->xh);
if(strcmp(p1->xh,"end")==0) break;
p1->last=p2;
}
head=p2;
p2->next=NULL;
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
for(;p!=NULL;)
{
printf("%s\n",p->xh);
p=p->last;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,128 |
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
|
15,129 |
struct student
{
char num[100];
char name[100];
char sex;
int age;
float score;
char add[100];
struct student *next;
};
int n;
struct student*input(void)
{
struct student *head,*p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf ("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
p1->next=NULL;
head=NULL;
while (strcmp("end",p1->num)!=0)
{
n++;
p2=(struct student*)malloc(LEN);
p2->next=p1;
p1=p2;
scanf ("%s",&p1->num);
if (strcmp("end",p1->num)==0) break;
else scanf ("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
}
head=p1->next;
return (head);
}
void main ()
{
struct student *p;
p=input();
while (p!=NULL)
{
printf ("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}
}
|
31
|
15,130 |
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(void)
{
struct Student * head,* end;
struct Student * p1,* p2;
n=0;
p1=p2=(struct Student *)malloc(LEN);
scanf("%s",p1->num);
head=NULL;
while(p1->num[0]!='e')
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
n++;
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;
if(end!=NULL)
do
{
printf("%s %s %c %d %s %s",p->num,p->name,p->sex,p->age,p->score,p->add);
putchar('\n');
p=p->pre;
}
while(p!=NULL);
}
int main()
{
struct Student * p;
p=creat();
print(p);
return 0;
}
|
31
|
15,131 |
struct student
{
char a[60];
struct student*next;
};
void main()
{
struct student *creat(void);
struct student *p;
p=creat();
for(;p!=NULL;)
{
puts(p->a);
p=p->next;
}
}
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int n=0;
p1=p2=(struct student *)malloc(LEN);
gets(p1->a);
for(;;)
{
n=n+1;
if(n==1)p2->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->a);
if(p1->a[0]=='e')
{head=p2;
return (head);}
}
}
|
31
|
15,132 |
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
|
15,133 |
struct Student
{
char id[9];
char name[20];
char gen;
int age;
char grade[10];
char add[20];
struct Student *next;
};
void main()
{
struct Student *head,*p2,*p1,*newstu,*newhead;
int i,n=1;
char e[]={"end"};
p1=p2=head=(struct Student*)malloc(sizeof(struct Student));
scanf("%s %s %c %d %s %s",
&p1->id,&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
while(1)
{
p1=(struct Student*)malloc(sizeof(struct Student));
scanf("%s",&p1->id);
if(strcmp(p1->id,e)==0) {p2->next=NULL;break;}
else
{
scanf(" %s %c %d %s %s",
&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
p2->next=p1;
p2=p1;
n++;
}
}
for(i=0;i<n;i++)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(i==0)
newhead=newstu=p1;
else
newstu=newstu->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<n;i++)
{
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->gen,p1->age,p1->grade,p1->add);
p1=p1->next;
}
}
|
31
|
15,134 |
struct student
{
char num[20];
char name[20];
char sex;
int age;
float score;
char address[1000];
struct student *next;
}stu[10000];
int main()
{
struct student *head,*p;
int i,j;
char str[4]="end";
for(i=0;;i++)
{
scanf("%s",stu[i].num);
if(strcmp(stu[i].num,str)==0)
break;
scanf("%s",&stu[i].name);
scanf(" %c",&stu[i].sex);
scanf("%d",&stu[i].age);
scanf("%f",&stu[i].score);
scanf("%s",&stu[i].address);
}
stu[0].next=NULL;
for(j=1;j<i;j++)
stu[j].next=&stu[j-1];
head=&stu[i-1];
if (i>0)
for(p=head;p!=NULL;p=p->next)
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
return 0;
}
|
31
|
15,135 |
struct stu
{
char info[1000];
struct stu * next;
};
struct stu * head;
struct stu * create()
{
char str1[]="end";
struct stu *p1,*p2,*p;
p1=(struct stu*)malloc(Len);
gets(p1->info);
p1->next=NULL;
if(strcmp(p1->info,str1)==0)
{
free(p1);
head=NULL;
return head;
}
else
{
head=p1;
p2=p1;
do{
p1=(struct stu*)malloc(Len);
gets(p1->info);
p=head;
if(strcmp(p1->info,str1)==0)
{
free(p1);
break;
}
else
{
p1->next=p2;
head=p1;
p2=p1;
}
}while(1);
return head;
}
}
void print(struct stu * head)
{
struct stu * p;
p=head;
if(head!=NULL)
do
{
puts(p->info);
p=p->next;
}while(p!=NULL);
}
void main()
{
create();
print(head);
}
|
31
|
15,136 |
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
|
15,137 |
// ???????????????
struct record
{
char str[100];
};
struct YyxNode
{
struct record m_rec;
struct YyxNode *next;
};
struct YyxStack
{
int n;
struct YyxNode *top;
};
struct YyxStack *CreateNewStack()
{
struct YyxStack *newSt;
if((newSt=(struct YyxStack*)malloc(sizeof(struct YyxStack)))==NULL){
printf("Error: memory out! (1)\n");
exit(-1);
}
newSt->n = 0;
newSt->top = NULL;
return newSt;
}
struct YyxStack *Push(struct YyxStack *st, const struct record *rec)
{
struct YyxNode *newNode;
if((newNode=(struct YyxNode*)malloc(sizeof(struct YyxNode)))==NULL){
printf("Error: memory out! (2)\n");
exit(-1);
}
newNode->m_rec = *rec;
newNode->next = st->top;
st->top = newNode;
st->n ++;
return st;
}
struct YyxStack *Top(struct YyxStack *st, struct record *rec)
{
*rec = st->top->m_rec;
return st;
}
struct YyxStack *Pop(struct YyxStack *st)
{
struct YyxNode *delNode = st->top;
if (delNode==NULL)
return st;
st->top = delNode->next;
st->n --;
free(delNode);
return st;
}
struct YyxStack *ClearStack(struct YyxStack *st)
{
while(st->top!=NULL)
Pop(st);
return st;
}
int main()
{
struct YyxStack *mainSt;
struct record stu;
mainSt = CreateNewStack();
gets(stu.str);
while(strcmp(stu.str, "end")){
Push(mainSt, &stu);
gets(stu.str);
}
while(mainSt->n>0){
Pop(Top(mainSt, &stu));
puts(stu.str);
}
// free(ClearStack(mainSt));
return 0;
}
|
31
|
15,138 |
struct stu
{
char inf[100];
struct stu *next;
};
void down(struct stu *now)
{
if (now->next!=0) down(now->next);
if (now->next!=0) printf("%s\n",now->inf);
}
int main()
{
void down(struct stu *now);
struct stu *head,*now,*neww;
head=(struct stu*) malloc(sizeof(struct stu));
head->next=0;
gets(head->inf);
now=head;
do
{
neww=(struct stu*) malloc(sizeof(struct stu));
neww->next=0;
gets(neww->inf);
now->next=neww;
now=neww;
// printf("%s\n",now->inf);
}while (strcmp(now->inf,"end")!=0);
down(head);
// int i;scanf("%d",&i);
return 0;
}
|
31
|
15,139 |
struct L
{
char a[6][20];
struct L *pq;
struct L *ph;
};
struct L *creat(void)
{
struct L *p1,*p2,*p3,*head,*end;
int i,j,k,l;
l=sizeof(struct L);
p1=head=(struct L *)malloc(l);
p1->pq=NULL;
do
{
for(i=0;i<6;i++)
scanf("%s",p1->a[i]);
p2=(struct L *)malloc(l);
p3=p2->pq=p1;
p1->ph=p2;
p1=p2;
}while(p3->a[0][0]!='e');
return p3->pq;
}
int main()
{struct L *creat(void);
int i,j;
struct L *head,*p1,*p2;
p1=head=creat();
do
{for(i=0;i<6;i++)
{if(i==0) printf("%s",p1->a[0]);
else printf(" %s",p1->a[i]);}
printf("\n");
p1=p1->pq;
}while(p1!=NULL);
}
|
31
|
15,140 |
struct stu
{
char num[50];
char name[50];
char sex;
int age;
float score;
char add[50];
struct stu *forward;
};
void main()
{ int n=0;
struct stu *head,*p1,*p2;head=NULL;
p1=p2=(struct stu *)malloc(LEN);
while(1)
{
n++;
if(n==1){head=p1;head->forward=NULL;}
else {p1->forward=p2;}
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)break;
scanf(" %s",p1->name);
scanf(" %c",&p1->sex);
scanf(" %d",&p1->age);
scanf(" %f",&p1->score);
scanf(" %s",p1->add);
p2=p1;
p1=(struct stu *)malloc(LEN);
}
struct stu *p;
p=p2;
if(p->forward!=NULL)
{
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->forward;
}while(p!=NULL);
}
}
|
31
|
15,141 |
struct student
{
char what[100];
struct student *last;
};
void print(struct student *p)
{
printf("%s\n",p->what);
if(p->last!=NULL)print(p->last);
}
main()
{
struct student stu,*head,*tail,*p1,*p2;
tail=(struct student*)malloc(LEN);
tail->last=NULL;
gets(tail->what);
p1=tail;
while(strcmp(p1->what,"end")!=0)
{
p2=(struct student*)malloc(LEN);
p2->last=p1;
gets(p2->what);
p1=p2;
}
head=p1->last;
print(head);
}
|
31
|
15,142 |
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
|
15,143 |
/*
* justexp.cpp
*
* Created on: 2011-11-18
* Author: dell
*/
int main()
{
struct data
{
char num[200];
char name[200];
char gender;
int age;
float score;
char add[200];
}student[2000];
int count=0;
while(true)
{
memset(student[count].num,'\0',sizeof(student[count].num));
cin>>student[count].num;
if(strcmp(student[count].num,"end")==0)
break;
cin>>student[count].name>>student[count].gender>>student[count].age>>student[count].score>>student[count].add;
count++;
}
while(count--)
{
cout<<student[count].num<<" "<<student[count].name<<" "<<student[count].gender<<" "<<student[count].age<<" "<<student[count].score<<" "<<student[count].add<<endl;
}
return 0;
}
|
31
|
15,144 |
struct student
{
char num[10];
char name[20];
char sex[5];
char age[5];
char score[10];
char adr[20];
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1;
head=p1=( struct student * ) malloc(LEN);
scanf("%s%s%s%s%s%s",p1->num,p1->name,p1->sex,p1->age,&p1->score,p1->adr);
p1->next=NULL;
while(p1->num[0]!='e')
{
p1=( struct student * ) malloc(LEN);
scanf("%s",p1->num);
if(p1->num[0]!='e')
{
scanf("%s%s%s%s%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->adr);
p1->next=head;
head=p1;
}
}
return(head);
}
void print(struct student *head)
{
struct student *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->adr);
p=p->next;
}
}
void main()
{
struct student *h;
h=creat();
print(h);
}
|
31
|
15,145 |
struct student
{
char str[1000];
struct student *next;
};
void main()
{
struct student a[1000],*p,*head;
int i,j,t;
for(i=0;;i++)
{
gets(a[i].str);
if(a[i].str[0]=='e')
break;
}
for(j=i-1;j>=0;j--)
{
head=&a[i-1]; /*???a[i-1]???a[i]????????*/
a[j].next=&a[j-1]; /*????????end*/
a[0].next=NULL;
}
p=head;
do
{
printf("%s\n",p->str);
p=p->next ;
} while(p!=NULL);
}
|
31
|
15,146 |
struct S
{
char xuehao[200];
char xingming[200];
char xingbie;
int nianling;
float defen;
char dizhi[200];
struct S *next;
};
int main()
{
struct S *p1,*p2,*head;
head=(struct S *)malloc(sizeof(struct S));
p1=head;
scanf("%s",p1->xuehao);
head->next=NULL;
while(p1->xuehao[0]!='e')
{
scanf("%s %c%d%f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->defen,p1->dizhi);
p2=(struct S*)malloc(sizeof(struct S));
p2->next=p1;
p1=p2;
scanf("%s",p1->xuehao);
}
while(p1->next!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->next->xuehao,p1->next->xingming,p1->next->xingbie,p1->next->nianling,p1->next->defen,p1->next->dizhi);
p1=p1->next;
}
return 0;
}
|
31
|
15,147 |
struct Student
{
char imf[100];
struct Student *next,*pre;
};
int main()
{
struct Student *p,*q,*h;
h=p=q=malloc(LEN);
gets(q->imf);
q->pre=q->next=NULL;
while(strcmp(q->imf,"end")!=0)
{
p=q;
q=malloc(LEN);
q->next=NULL;
q->pre=p;
p->next=q;
gets(q->imf);
}
while(p!=NULL)
{
puts(p->imf);
p=p->pre;
}
}
|
31
|
15,148 |
//struct student
struct student
{
char content[50];
struct student *next;
};
int main()
{
struct student *head,*p1,*p2,*p3,*h,*p4,*p5,*p6;
int i,j,k;
char s[16];
s[0]='e';
s[1]='n';
s[2]='d';
s[3]='\0';
int m=0;
p6=p4=p5=p3=p1=p2=(struct student *)malloc(sizeof(struct student));
gets(p1->content);
p4=p1;
for(;strcmp(p1->content,s)!=0;)
{
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
p1->next=p2;
gets(p1->content);
}
p4->next=NULL;
p3=head=p1->next;
m=0;
for(;p3!=NULL;)
{
m++;
if(m==1)
{
printf("%s",p3->content);
}
else
{
printf("\n%s",p3->content);
}
p3=p3->next;
}
return 0;
}
|
31
|
15,149 |
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
|
15,150 |
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,*p1,*p2;
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;
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;
p2->next=p1;
p2=p1;
}
}while(1);
return(head);
}
void print(struct student*head)
{
struct student*p,*ppr;
while(head->next!=NULL)
{
ppr=head;
p=head->next;
while(p->next!=NULL)
{
ppr=p;
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address);
ppr->next=NULL;
}
printf("%s %s %c %d %s %s\n",head->ID,head->name,head->sex,head->age,head->score,head->address);
}
int main()
{
struct student*head;
head=creat();
print(head);
}
|
31
|
15,151 |
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
|
15,152 |
struct student
{
char inf[200];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=(struct student *)malloc(LEN);
p2=p1;
gets(p1->inf);
head=NULL;
do
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->inf);
}
while(strcmp((p1->inf),"end")!=0);
p2->next=NULL;
return(head);
}
int main()
{
struct student *r,*headr;
r=creat();
headr=r;
r=r->next;
for(;r!=headr;)
{
for(r=headr;r->next!=NULL;)r=r->next;
printf("%s\n",r->inf);
for(r=headr;(r->next)->next!=NULL;)r=r->next;
r->next=NULL;
}
printf("%s",headr->inf);
}
|
31
|
15,153 |
struct node
{
char num[20];
char name[20];
char gender;
int age;
char score[10];
char addr[20];
struct node *next;
struct node *back;
};
void main()
{
char scan[100],constant[]="end";
struct node beginning,*head,*p,*ending,*t;
int count=1,i;
head=&beginning;
beginning.next=NULL;
beginning.back=NULL;
p=head;
ending=p;
scanf("%s %s %c %d %s %s",beginning.num,beginning.name,&beginning.gender,&beginning.age,beginning.score,beginning.addr);
scanf("%s",scan);
while(strcmp(scan,constant)!=0)
{
p->next=(struct node *)malloc(sizeof(struct node));
t=p;
p=p->next;
strcpy(p->num,scan);
scanf("%s %c %d %s %s",p->name,&p->gender,&p->age,p->score,p->addr);
p->back=t;
ending=p;
scanf("%s",scan);
count++;
}
p=ending;
for(i=1;i<=count;i++)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->gender,p->age,p->score,p->addr);
p=p->back;
}
}
|
31
|
15,154 |
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
|
15,155 |
struct student
{char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
};
int main()
{int i=0,s=0;
int t=0;
struct student stu[1000];
scanf("%s",stu[0].num);
while(stu[i].num[0]!='e'){
scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
i++;
s++;
scanf("%s",stu[i].num);
}
for(i=s-1;i>=0;i--){
printf("%s %s %c %d %s %s\n",stu[i].num,stu[i].name,stu[i].sex,stu[i].age,stu[i].score,stu[i].add);
}
return 0;
}
|
31
|
15,156 |
struct student
{
char num[20];
char name[20];
char sex[5];
int age;
char score[10];
char address[30];
struct student *next;
};
int n;
int main()
{
struct student *p1,*p2,*p;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
n++;
if(n==1)p1->next=NULL;
scanf("%s%s%d%s%s\n",p1->name,p1->sex,&p1->age,p1->score,p1->address);
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
p1->next=p2;
p2=p1;
}
p=p1->next;
while(p!=0)
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
return 0;
}
|
31
|
15,157 |
struct stu{
char info[50];
struct stu *next;
};
int main(int argc, char* argv[])
{
struct stu *head,*p1,*p2;
p2=NULL;
while(1){
p1=(struct stu*)malloc(LEN);
gets(p1->info);
if(strcmp(p1->info,"end")==0){
break;
}
p1->next=p2;
p2=p1;
}
head=p2;
p1=head;
while(1){
printf("%s\n",p1->info);
if(p1->next==NULL){
break;
}
p1=p1->next;
free(p2);
p2=p1;
}
return 0;
}
|
31
|
15,158 |
struct Student
{
char inf[81];
struct Student *front,*next;
};
int n;
struct Student *creat()
{
struct Student *head,*p1,*p2,*temp;
n=0;
p1=p2=(struct Student *)malloc(LEN);
gets(p1->inf);
head=NULL;
while(strcmp(p1->inf,"end")!=0)
{
n++;
if(n==1)
{
head=p1;p1->front=NULL;
}
else
{
p2->next=p1;
p1->front=temp;
}
p2=p1;
temp=p1;
p1=(struct Student *)malloc(LEN);
gets(p1->inf);
}
p2->next=NULL;
return(p2);
}
int main()
{
struct Student *pt;
pt=creat();
if(pt!=NULL)
{
do
{
puts(pt->inf);
pt=pt->front;
}
while(pt!=NULL);
}
return 0;
}
|
31
|
15,159 |
struct student
{
int age;
float score;
char name[100],sex,add[20],num[20];
struct student *p;
};
void main()
{
struct student *p1,*head;
p1=head=(struct student *) malloc(LEN);
p1->p=NULL;
scanf("%s %s %c %d %f %s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
while (1)
{
p1=(struct student *) malloc(LEN);
scanf("%s",p1->num);
if (p1->num[0]!='e')
{
scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
p1->p=head;
head=p1;
}
else break;
}
p1=head;
while (p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->p;
}
}
|
31
|
15,160 |
struct student
{
char a[100];
struct student *next;
};
int main()
{
struct student *p1,*p2;
p1=(struct student*)malloc(len);
p1->next=NULL;
gets(p1->a);
while((strcmp(p1->a,"end"))!=0)
{
p2=p1;
p1=(struct student*)malloc(len);
p1->next=p2;
gets(p1->a);
}
p1=p1->next;
while(p1!=NULL)
{
printf("%s\n",p1->a);
p1=p1->next;
}
return 0;
}
|
31
|
15,161 |
int main()
{
int m,n,i,s;
char a[1000][100];
for(i=1;;i++)
{
gets(a[i]);
if(strcmp(a[i],"end")==0)
break;
}
for(s=i-1;s>0;s--)
printf("%s\n",a[s]);
return 0;
}
|
31
|
15,162 |
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
|
15,163 |
void main()
{
char stu[10000][100],tem[100]={'e','n','d'};
int i,j;
for (i=0;i<10000;i++)
{
gets(stu[i]);
if (strcmp(stu[i],tem)==0)break;
}
for(j=i-1;j>=0;--j)
printf("%s\n",stu[j]);
}
|
31
|
15,164 |
main()
{
char a[3000][50],end[5]="end";int i=-1;
do
{
i++;
gets(a[i]);
}
while(a[i][0]!='e');
i--;
while(i>=0)
{
puts(a[i]);
i--;
}
}
|
31
|
15,165 |
struct student
{
char num[100];
struct student *prev;
};
main()
{
struct student *p1,*p2;
int flag=0;
while (1)
{
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->num);
if (*(p1->num)=='e') break;
else
{
if (flag==0)
{
p2=p1;
p1->prev=NULL;
flag=1;
}
else
{
p1->prev=p2;
p2=p1;
}
}
}
while (p2!=NULL)
{
printf("%s\n",p2->num);
p2=p2->prev;
}
return 0;
}
|
31
|
15,166 |
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
|
15,167 |
struct stu
{
char num[30];
char name[30];
char sex;
int age;
float score;
char add[30];
struct stu *next;
};
struct stu *p1,*p2,*head;
int main()
{
void result(struct stu*);
p1=p2=(struct stu*) malloc(sizeof(struct stu));
scanf("%s ",p1->num);
scanf("%s ",p1->name);
scanf("%c",&(p1->sex));
scanf("%d",&(p1->age));
scanf("%g",&(p1->score));
scanf("%s",p1->add);
head=p1;head->next=0;
for(;;)
{
p1=(struct stu*) malloc(sizeof(struct stu));
p2->next=p1;
scanf("%s",p1->num);
if(p1->num[0]=='e'&&p1->num[1]=='n'&&p1->num[2]=='d')
{p2->next=0;goto print;}
scanf("%s ",p1->name);
scanf("%c",&(p1->sex));
scanf("%d",&(p1->age));
scanf("%g",&(p1->score));
scanf("%s",p1->add);
p2=p1;
}
print:result(head);
return 0;
}
void result(struct stu *x)
{
if(x->next==0)
{printf("%s ",x->num);
printf("%s ",x->name);
printf("%c",x->sex);
printf(" %d",x->age);
printf(" %g",x->score);
printf(" %s",x->add);
printf("\n");
}
else
{
result(x->next);
printf("%s ",x->num);
printf("%s ",x->name);
printf("%c",x->sex);
printf(" %d",x->age);
printf(" %g",x->score);
printf(" %s",x->add);}
printf("\n");
}
|
31
|
15,168 |
struct student
{
char info[100];
struct student *next;
struct student *former;
};
int main()
{
struct student *head,*tail,*p;
char s[100];
p=(struct student*)malloc(sizeof(struct student));
gets(p->info);
head=p;
head->former=NULL;
tail=p;
while (strcmp(p->info,"end")!=0)
{
p=(struct student*)malloc(sizeof(struct student));
gets(p->info);
tail->next=p;
p->former=tail;
tail=p;
}
while (p->former!=NULL)
{
p=p->former;
printf("%s\n",p->info);
}
return 0;
}
|
31
|
15,169 |
struct node
{
struct node *last;
char id[15];
char name[25];
char sex;
int age;
char score[10];
char addr[15];
struct node *next;
};
int n=1;
struct node *newnode()
{
struct node *head=NULL,*New,*This;
do
{
New=(struct node *)malloc(sizeof(struct node));
scanf("%s",New->id);
if(n==1)
{
head=New;
New->last=NULL;
This=head;
}
else
{
This->next=New;
New->last=This;
}
if(strcmp(New->id,"end")!=0)
{
scanf("%s %c %d %s %s",New->name,&New->sex,&New->age,New->score,New->addr);
This=New;
n++;
}
}while(strcmp(New->id,"end")!=0);
This->next=NULL;
return(This);
}
void main()
{
struct node *p;
p=newnode();
do
{
printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->addr);
p=p->last;
}while(p->last!=NULL);
printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->addr);
}
|
31
|
15,170 |
struct stu
{
char data[100];
struct stu *next;
};
void main()
{
struct stu *head;
struct stu *p1,*p2;
p1=(struct stu *)malloc(LEN);
p1->next=NULL;
gets(p1->data);
while(strcmp(p1->data,"end"))
{
p2=(struct stu *)malloc(LEN);
p2->next=p1;
p1=p2;
gets(p1->data);
}
head=p1->next;
for(p2=head;p2;p2=p2->next)
puts(p2->data);
}
|
31
|
15,171 |
struct student
{
char str[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(len);
gets(p1->str);
if(strcmp(p1->str,"end")==0)
{
free(p1);
head=NULL;
return head;
}
else
{
p1->next=NULL;
head=p1;
p2=p1;
do
{
p1=(struct student*)malloc(len);
gets(p1->str);
if(strcmp(p1->str,"end")==0)
{
free(p1);
break;
}
else
{
p1->next=NULL;
p1->next=p2;
p2=p1;
head=p1;
}
}
while(1);
return head;
}
}
int main()
{
struct student *p,*pa;
pa=creat();
p=pa;
do
{
printf("%s\n",p->str);
p=p->next;
}
while(p!=NULL);
return 0;
}
|
31
|
15,172 |
struct stu
{
char id[500];
struct stu *next;
struct stu *pre;
};
void main()
{
int n;
struct stu *p1,*p2,*head,*tail,*p;
n=0;
p1=p2=(struct stu*)malloc(sizeof(struct stu));
gets(p1->id);
while(strcmp(p1->id,"end")!=0)
{
n=n+1;
if(n==1)
{
head=p1;
p1->pre=NULL;
}
else
{
p2->next=p1;
p1->pre=p2;
}
p2=p1;
p1=(struct stu*)malloc(sizeof(struct stu));
gets(p1->id);
}
p2->next=NULL;
tail=p2;
p=tail;
do
{
printf("%s\n",p->id);
p=p->pre;
}while(p!=NULL);
}
|
31
|
15,173 |
struct student
{
char ID[20];
char name[20];
char sex;
int age;
char score[20];
char address[20];
struct student *next;
};
struct student *create()
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;}
else
{
head=p1;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
p2=p1;
do
{
p1=(struct student*)malloc(LEN);
p1->next=NULL;
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){p2->next=NULL;free(p1);break;}
else
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p2->next=p1;
p1->next=NULL;
p2=p1;
}
}while(1);
}
return(head);
}
void print(struct student *list)
{
if(list==NULL)return;
else if(list->next==NULL)
printf("%s %s %c %d %s %s\n",list->ID,list->name,list->sex,list->age,list->score,list->address);
else
{
print(list->next);
printf("%s %s %c %d %s %s\n",list->ID,list->name,list->sex,list->age,list->score,list->address);
}
}
int main()
{
struct student *head;
head=create();
print(head);
}
|
31
|
15,174 |
struct student
{
char infor[100];
struct student *next;
};
struct student *creat(void)
{ struct student *head;
struct student *p1,*p2;
int n;
char l[4]={"end"};
n=0;
p1=p2=(struct student *)malloc(LEN);
gets(p1->infor);
head=NULL;
while(strcmp(p1->infor,l)!=0)
{ n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->infor);
}
p2->next=NULL;
return(head);
}
void print(struct student *head)
{
struct student *p,*p1,*p2;
p=p1=p2=head;
p2=p->next;
p1=p2->next;
head->next=NULL;
for(;p1->next!=NULL;)
{
p2->next=p;
p=p2;
p2=p1;
p1=p1->next;
}
p2->next=p;
p1->next=p2;
head=p1;
p=head;
for(;p!=NULL;)
{printf("%s\n",p->infor);
p=p->next;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,175 |
struct stu
{
char infor[50];
struct stu*previous;
};
void main()
{
struct stu*p,*q,*head;
p=(struct stu*)malloc(sizeof(struct stu));
p->previous=NULL;
gets(p->infor);
while(strcmp(p->infor,"end")!=0)
{
q=(struct stu*)malloc(sizeof(struct stu));
q->previous=p;
p=q;
gets(p->infor);
}
head=p->previous;
for(p=head;p!=NULL;p=p->previous)
puts(p->infor);
}
|
31
|
15,176 |
struct student{
struct student *pre;
char s[100];
struct student *next;
};
struct student *creat()
{
struct student *p1,*p2;
p1=(struct student*)malloc(len);
gets(p1->s);
p1->pre=NULL;
p1->next=NULL;
p2=p1;
while(strcmp(p1->s,"end"))
{
p1=(struct student*)malloc(len);
gets(p1->s);
p1->pre=p2;
p2->next=p1;
p1->next=NULL;
p2=p1;
}
return(p1->pre);
}
void print(struct student *end)
{
while(end)
{
puts(end->s);
end=end->pre;
}
}
void main()
{
struct student *end;
end=creat();
print(end);
}
|
31
|
15,177 |
struct s
{
char xh[50];
char xm[55];
char xb;
int nl;
char df[50];
char dz[50];
struct s *next;
};
void main()
{
struct s *head,*p1,*p2,*p;
p2=(struct s *)malloc(len);
scanf("%s",p2->xh);
p2->next=NULL;
while(strcmp(p2->xh,"end")!=0)
{
scanf("%s",p2->xm);
scanf(" %c",&p2->xb);
scanf(" %d",&p2->nl);
scanf(" %s",p2->df);
scanf(" %s",p2->dz);
head=p2;
p1=p2;
p2=(struct s *)malloc(len);
scanf("%s",p2->xh);
p2->next=p1;
}
p=head;
while(p!=NULL)
{printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->xb,p->nl,p->df,p->dz);
p=p->next;}
}
|
31
|
15,178 |
struct student
{
/*char id[20];
char name[10];
char sex;
int age;
int score;
char addr[20];*/
char s[100];
struct student *next;
};
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);
gets(p1->s);
/*while(p1->s!="end")*/
while(strcmp(p1->s,"end")!=0)
{
//printf(p1->s);
//scanf("%s %c %d %d %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
n++;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
//scanf("%s",p1->id);
gets(p1->s);
}
//printf(p1->s);
head=p2;
//printf(p2->s);
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
//printf(p->s);
if(head!=NULL)
do
{
//printf("%s %s %c %d %d %s",p->id,p->name,p->sex,p->age,p->score,p->addr);
if (p->next != NULL)
{
printf(p->s);
printf("\n");
}
else
printf(p->s);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student*head;
head=creat();
print(head);
}
|
31
|
15,179 |
struct student
{
char locate[100];
struct student *next;
struct student *last;
};
int n;
char u[100];
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->locate);
strcpy(u,p1->locate);
head=NULL;
while(strcmp(p1->locate,"end")!=0)
{n=n+1;
if(n==1){head=p1;}
else {p2->next=p1;p1->last=p2;}
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->locate);
}
p1->last=p2;
p2->next=NULL;
return(p2);
}
void main()
{
struct student *creat(void);
struct student *p;
p=creat();
do
{printf("%s\n",p->locate);
p=p->last;
}while(strcmp(p->locate,u)!=0);
printf("%s",p->locate);
}
|
31
|
15,180 |
struct stu
{
char id[10];
char name[20];
char sex;
int age;
char score[10];
char addr[20];
struct stu *next;
};
int main()
{
struct stu *creat(void);
void output(struct stu*head);
struct stu *head,*p;
head=NULL;
head=creat();
p=head;
output(head);
}
struct stu *creat(void)
{
int i;
struct stu*p1,*p2,*p3,*head;
head=NULL;
p1=(struct stu*)malloc(LEN);
if(head==NULL) head=p2=p3=p1;p1->next=NULL;
scanf("%s",p1->id);
while(p1->id[0]!='e')
{
p3=p2;
scanf(" %s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
p1=(struct stu*)malloc(LEN);
p1->next=p2;
p2=p1;
scanf("%s",p1->id);
}
head=p3;
return head;
}
void output(struct stu*head)
{
struct stu*p1,*p2;
p1=head;
while(p1!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->next;
}
}
|
31
|
15,181 |
struct student
{
char c[100];
struct student*next;
};
struct student*creat()
{
struct student*p1,*p2,*p;
int i;
p1=p2=(struct student*)malloc(sizeof(struct student));
p=p1;
gets(p1->c);
while(strcmp(p1->c,"end")!=0)
{
p1=(struct student*)malloc(sizeof(struct student));
gets(p1->c);
if(strcmp(p1->c,"end")==0) break;
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return p;
}
struct student*change(struct student*p)
{
struct student*p1,*p2,*p3;
p1=p;
p2=p;
p3=NULL;
while(p1->next!=NULL)
{
p2=p1->next;
p1->next=p3;
p3=p1;
p1=p2;
}
p1->next=p3;
return(p1);
}
void print(struct student*p)
{
struct student *p1,*p2;
p1=p;
while(p1!=NULL)
{
printf("%s\n",p1->c);
p1=p1->next;
}
}
void main()
{
struct student *p,*p1;
p=creat();
p=change(p);
print(p);
}
|
31
|
15,182 |
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
|
15,183 |
void main()
{
int i,j,k,m,n;
struct stu
{
char xh[100];
char xm[100];
char xb;
int nl;
float df;
char dz[100];
struct stu *af;
struct stu *bf;
};
struct stu *p1,*p2,*head;
head=p2=p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s %s %c %d %f %s",p1->xh,p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p1->bf=0;
for(i=1;;i++)
{
p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s",p1->xh);
if(strcmp(p1->xh,"end")==0)
{
head=p2;
break;
}
scanf("%s %c %d %f %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p2->af=p1;
p1->bf=p2;
p2=p1;
}
p1=head;
for(j=0;j<i;j++)
{
printf("%s %s %c %d %g %s\n",p1->xh,p1->xm,p1->xb,p1->nl,p1->df,p1->dz);
p1=p1->bf;
}
}
|
31
|
15,184 |
struct Student
{
char id[100];
char name[300];
int age;
char sex;
char score[100];
char address[300];
struct Student *before;
}s[2500];
main()
{
struct Student *p,*q,*head;
int i=0,j,k,n,m;
scanf("%s",&s[0].id);
p=&s[0];
q=NULL;
while (p!=NULL)
{
scanf("%s %c%d%s%s",p->name,&p->sex,&p->age,p->score,p->address);
p->before=q;
q=p;
scanf("%s",&s[i+1].id);
if (strcmp(s[i+1].id,"end")==0)
{
p=NULL;
head=q;
}
else {
p=&s[i+1];
i++;
}
}
p=head;q=NULL;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address);
p=p->before;
}
}
|
31
|
15,185 |
struct student
{
char num[100];
char name[100];
char gender[2];
char age[100];
char score[100];
char add[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head,*p1;
head=NULL;
while(1)
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
p1->next=head;
if(strcmp(p1->num,"end")==0)
break;
scanf("%s%s%s%s%s",p1->name,p1->gender,p1->age,p1->score,p1->add);
head=p1;
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
while(p!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->gender,p->age,p->score,p->add);
p=p->next;
}
}
void main()
{
struct student *po;
po=creat();
print(po);
}
/*??????????????????????????????????????
????
?????????????????????
00630018 zhouyan m 20 10.0 28#460
??????"end"??
????
????????
?? ?? ?? ?? ?? ??
???????
????
00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
end
????
10630018 zouan m 20 10 28#46000
0630018 zuyan m 21 100 28#4600
01030018 houyan m 20 10 28#4600
00160018 zouyan f 21 100 28#4600
00613018 zhuyan m 20 100 28#4600
0063018 zhouan m 21 10000 28#4600000
0063008 zhoyan f 20 1000 28#460000
0063001 zhouyn f 21 100 28#460000
00630018 zhouyan m 20 10 28#4600*/
|
31
|
15,186 |
struct student
{
char str[100];
struct student *next;
struct student *front;
};
struct student *create()
{
struct student *head,*pf,*pa,*end;
int n=1,flag=0;
do
{
pa=(struct student *) malloc(LEN);
gets(pa->str);
if(strcmp(pa->str,"end")==0)
{
if(n==1) flag=1;
break;
}
if(n==1)
{
head=pa;
pf=pa;
pa->front=NULL;
n++;
}
else
{
pf->next=pa;
pa->front=pf;
pf=pa;
}
}while(n!=0);
if(flag==0){pf->next=NULL;
end=pf;}
else{head=pa; end=NULL;}
return(end);
}
int main()
{
struct student *end,*pt;
end=create();
pt=end;
while(pt!=NULL)
{
printf("%s\n",pt->str);
pt=pt->front;
}
return 0;
}
|
31
|
15,187 |
void main()
{struct student
{char a[100];
struct student *next;
} *p1,*p2,*head;
int n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
head=NULL;
gets(p1->a);
while(strcmp(p1->a,"end"))
{n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->a);
}
p2->next=NULL;
for(;;)
{ for(p2=head;;p2=p2->next)
{ p1=p2->next;
if(p1->next==NULL)
{printf("%s\n",p1->a);
p2->next=NULL;
break;
}
}
if(p2==head)
{printf("%s\n",head->a);
break;
}
}
}
|
31
|
15,188 |
struct stu
{
char a[1000];
struct stu *next;
};
void main()
{
struct stu *head,*p1,*p2;
p1=p2=(struct stu*)malloc(LEN);
head=p1;
p1->next=NULL;
gets(p1->a);
while (strcmp(p1->a,"end")!=0)
{
p1=(struct stu*)malloc(LEN);
gets(p1->a);
head=p1;
p1->next=p2;
p2=p1;
}
p1=head->next;
while (p1!=NULL)
{
puts(p1->a);
p1=p1->next;
}
}
|
31
|
15,189 |
struct student
{
char num[12];
char name[25];
char sex;
int age;
char score[6];
char add[12];
}stu[max];
int main()
{
int i,n,j;
for(i=0;;i++)
{
scanf("%s",stu[i].num);
if(stu[i].num[0]=='e')
{
break;
}
else
scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
}
if(i==0)
printf("\n");
else
{
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);
}
return 0;
}
|
31
|
15,190 |
struct student
{
char num[20];
char name[20];
char sex[2];
int age;
float score;
char add[100];
struct student *next;
};
int main()
{
struct student *p1,*p2,*head;
p1=(struct student*)malloc(sizeof(struct student));
p1->next=NULL;
scanf("%s",p1->num);
if (p1->num[0]!='e')
{
while (p1->num[0]!='e')
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
p2=p1;
p1=(struct student*)malloc(sizeof(struct student));
p1->next=p2;
scanf("%s",p1->num);
}
head=p2;
while (head!=NULL)
{
printf("%s %s %s %d %g %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
head=head->next;
}
}
return 0;
}
|
31
|
15,191 |
void myPrint()
{
char str[100];
gets(str);
if(strcmp(str,"end"))
myPrint();
else
return;
puts(str);
}
int main()
{
myPrint();
return 0;
}
|
31
|
15,192 |
void main()
{
struct fy
{
char xh[100];
char xm[100];
char xb;
int nl;
float df;
char dz[100];
struct fy *pre;
};
struct fy *p,*node;
int n=1;
for(;;)
{
node= (struct fy *)malloc(sizeof(struct fy));
if(n==1) node->pre=NULL;
else node->pre=p;
scanf("%s",node->xh);
if(strcmp(node->xh,"end")==0) break;
scanf("%s %c %d %f %s",node->xm,&node->xb,&node->nl,&node->df,node->dz);
p=node;
n++;
}
for(;node->pre!=NULL;)
{
node=node->pre;
printf("%s %s %c %d %g %s\n",node->xh,node->xm,node->xb,node->nl,node->df,node->dz);
}
}
|
31
|
15,193 |
//???????
struct student
{ char info[50];
struct student *next;
}*p1,*p2;
int n;
//????
struct student *creat (void)
{
struct student *head;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->info);
head = NULL;
while(strcmp(p1->info,"end"))
{
n = n+1;
if(n==1)
head = p1;
else
p2->next = p1;
p2 = p1;
p1 = (struct student*)malloc(LEN);
gets(p1->info);
}
p2->next = NULL;
return(head);
}
struct student *turnback(struct student *head)
{
struct student *p,*newhead=NULL;
do
{
p2=NULL;
p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next ;
}
if(newhead==NULL)
{
newhead=p1;
p=newhead->next=p2;
}
p=p->next=p2;
p2->next=NULL;
}while(head->next!=NULL);
return(newhead);
}
void output(struct student *outhead)
{
for(p1=outhead;p1!=NULL;p1=p1->next)
puts(p1->info);
}
void main()
{
struct student *head;
head=creat();
head=turnback(head);
output(head);
printf("\n");
}
|
31
|
15,194 |
//#include<stdlib.h>//
struct student
{
struct student *bef;
char n[10];
char s[20];
char sex;
int age;
char score[10];
char address[20];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",(p1->n),(p1->s),&(p1->sex),&(p1->age),p1->score,p1->address);
while(p1->n[0]!='e')
{
n=n+1;
if(n==1)
{
p1->bef=NULL;
}
else
{
p2->next=p1;
p1->bef=p2;
}
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->n,p1->s,&(p1->sex),&(p1->age),p1->score,p1->address);
}
p2->next=NULL;
return(p2);
}
int main()
{
struct student *p;
p=creat();
do
{
printf("%s %s %c %d %s %s\n",p->n,p->s,p->sex,p->age,p->score,p->address);
p=p->bef;
}while(p!=NULL);
return 0;
}
|
31
|
15,195 |
struct student
{
char num[20];
char name[20];
char sex[20];
char age[20];
char score[20];
char add[20];
struct student *next;
};
int n;
void main()
{
int i;
struct student *head,*p1,*p2,*newhead,*new;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)//built link;
{
scanf("%s%s%s%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);
}
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=new=p1;
else new=new->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<n;i++)
{
printf("%s %s %s %s %s %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
printf("\n");
}
}
|
31
|
15,196 |
struct student
{
char a[80];
struct student *pro;
};
struct student *creat()
{
struct student *end,*p1,*p2;
p2=(struct student *)malloc(sizeof(struct student));
gets(p2->a);
p2->pro=NULL;
p1=p2;
do
{
p2=(struct student *)malloc(sizeof(struct student));
gets(p2->a);
if (strcmp(p2->a,"end")==0)
{
free(p2);
break;
}
else
{
p2->pro=p1;
p1=p2;
end=p2;
}
}
while(1);
return(end);
}
void destroy(struct student *end)
{
struct student *p;
p=end;
while(end)
{
p=end;
end=end->pro;
free(p);
}
}
void main()
{
struct student *creat();
void destroy(struct student *end);
struct student *end,*p;
end=creat();
p=end;
do
{
puts(p->a);
p=p->pro;
}
while (p);
destroy(end);
}
|
31
|
15,197 |
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
|
15,198 |
/*?? ?? ?? ?? ?? ??*/
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
|
15,199 |
struct student
{char information[100];
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->information);
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 *p)
{
do
{
printf("%s\n",p->information);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.