id
int32 0
32.5k
| code
stringlengths 95
8.4k
| label
stringclasses 65
values |
---|---|---|
15,200 |
struct student
{
char information[50];
struct student *next;
};
int main()
{
struct student *create_and_reverse();
void print(struct student *head);
struct student *head;
head=create_and_reverse();
print(head);
return 0;
}
struct student *create_and_reverse()
{
struct student *p1,*p2,*head;
char end[50]={'e','n','d'};
p1=(struct student *)malloc(len);
p2=p1;
gets((p1->information));
for(;;)
{
p1=(struct student *)malloc(len);
gets((p1->information));
if(strcmp(p1->information,end))
{
(p1->next)=p2;
}
else
{
head=p2;
break;
}
p2=p1;
}
return (head);
}
void print(struct student *head)
{
struct student *p;
p=head;
for(;;)
{
printf("%s\n",p->information);
if((p->next)==NULL)
{
break;
}
else
{
p=(p->next);
}
}
}
|
31
|
15,201 |
struct num
{
char content[50];
struct num *next;
};
struct num *crea()
{
long i;
struct num *head;
struct num *p1,*p2;
p1=p2=(struct num *)malloc(LEN);
head=p1;
gets(p1->content);
head->next=NULL;
for(;;)
{
p1=(struct num *)malloc(LEN);
gets(p1->content);
if(p1->content[0]!='e')
{
p1->next=p2;
p2=p1;
}
else {p1->next=p2,p2=p1;break;}
}
return(p1);
}
int 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\n",p->content);
return 0;
}
|
31
|
15,202 |
struct student
{char num[10];
char name[20];
char fm;
int age;
int score;
char add[50];
struct student *next;
};
int n;
struct student *creat(void)
{struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->num);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{n=n+1;
if(n==1) p1->next=NULL;
else p1->next=p2;p2=p1;head=p2;
p1=(struct student*)malloc(LEN);
gets(p1->num);
}
return head;
}
int main()
{struct student *head;
struct student *p1,*p2;
struct student *creat(void);
head=creat();
void print (struct student *head);
print(head);
}
void print (struct student *head)
{struct student *p;
p=head;
if(head!=NULL)
do {printf("%s\n",p->num);
p=p->next;}while (p!=NULL);
}
|
31
|
15,203 |
struct stu
{
char a[50];
struct stu* b;
};
int main()
{
struct stu* p1,* p2,stu;
p1=p2=&stu;
p1->b=NULL;
gets(p1->a);
for(;;)
{
if(strcmp(p2->a,"end")==0) break;
p2=(struct stu*)malloc(N);
gets(p2->a);
p2->b=p1;
p1=p2;
}
p2=p2->b;
for(;;)
{
printf("%s",p2->a);
if(p2->b==NULL) break;
p2=p2->b;
printf("\n");
}
}
|
31
|
15,204 |
int main(){
int i,n;
struct information{
char num[20];
char name[20];
char sex;
int age;
char score[100];
char address[20];
}stu[1000]; //????
for(i=0;i<1000;i++){
cin>>stu[i].num;
if((stu[i].num[0]=='e')&&(stu[i].num[1]=='n')&&(stu[i].num[2]=='d')){
n=i-1;
break;} //???end?????
else{
cin>>stu[i].name;
cin>>stu[i].sex;
cin>>stu[i].age;
cin>>stu[i].score;
cin>>stu[i].address;}
} //????
for(i=n;i>=0;i--){
cout<<stu[i].num<<" "<<stu[i].name<<" "<<stu[i].sex<<" "<<stu[i].age<<" "<<stu[i].score<<" "<<stu[i].address<<endl;
} //????
return 0;
}
|
31
|
15,205 |
struct student
{
char num[100];
char name[100];
char sex;
int age;
float score;
char ad[100];
struct student *next;
struct student *former;
};
int n=1;
struct student *creat()
{
struct student *thisnode,*newnode,*head;
do
{
newnode=(struct student *)malloc(sizeof(struct student));
scanf("%s",newnode->num);
if(newnode->num[0]!='e')
{
scanf("%s %c%d%f%s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->ad);
head=newnode;
if(n==1) newnode->former=NULL;
else
{
thisnode->next=newnode;
newnode->former=thisnode;
}
thisnode=newnode;
n=n+1;
}
else
{
thisnode->next=NULL;
}
}while(newnode->num[0]!='e');
return(head);
}
void main()
{
struct student *p;
p=creat();
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad);
p=p->former;
}while(p!=NULL);
}
|
31
|
15,206 |
struct student /*??student?????????????????????????*/
{
char num[40];
int age;
char score[20];
char name[40];
char gender;
char addr[40];
struct student *next;
}*p1,*p2; /*???p1,p2?????????????*/
int n;
struct student *creat(void); /*?????????*/
struct student *backward(struct student*); /*???????*/
void output(struct student*); /*???????*/
void free(struct student); /*?????????*/
int main()
{
struct student * head;
head=creat(); /*?????????*/
head=backward(head); /*???????*/
output (head); /*??????*/
free(head); /*??????????*/
return 0;
}
struct student *creat(void) /*?????????????????????????*/
{
struct student*head;
n=0;
p1=p2=(struct student*)malloc(LEN); /*???????*/
head=NULL; /*?????NULL*/
char tmp[40];
scanf("%s",tmp);
while (strcmp(tmp,"end")!=0) /*?????????????end*/
{
scanf(" %s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->addr);
strcpy(p1->num,tmp);
n=n+1;
if (n==1) /*????????????*/
head=p1;
else
p2->next=p1; /*???????????????next???????????*/
p2=p1;
p1=(struct student*)malloc(LEN); /*???????*/
scanf("%s",tmp);
}
p2->next=NULL; /*?????????*/
return(head); /*????????????*/
}
struct student *backward(struct student * head) /*??????????????????????*/
{
struct student *new_head; /*????????????*/
p1=head;
p2=NULL;
while(p1->next!=NULL) /*????????????*/
{
p2=p1;
p1=p1->next;
}
new_head=p1; /*??????*/
p1->next=p2; /*???????next???????*/
p2->next=NULL; /*???????next??NULL*/
while(head->next!=NULL) /*??????next?NULL????*/
{
p1=head;
p2=NULL;
while(p1->next!=NULL) /*?????????????next????????????????next??NULL*/
{
p2=p1;
p1=p1->next;
}
p1->next=p2;
p2->next=NULL;
}
return (new_head); /*?????????*/
}
void output(struct student*outhead) /*??????*/
{
for (p1=outhead;p1!=NULL;p1=p1->next) /*????????????????????*/
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->gender,p1->age,p1->score,p1->addr);
}
}
void free(struct student*head) /*?????????*/
{
for(p1=head;p1!=NULL;p1=p1->next)
{
free(p1);
}
}
|
31
|
15,207 |
struct student
{char info[100];
struct student *next1;
struct student *next2;
};
int n,i;
struct student *creat(void)
{
struct student *p1,*p2,*p3;
n=0;
p3=p2=p1=(struct student*)malloc(LEN);
gets(p1->info);
while(p1->info[0]!='e')
{
n+=1;
if(n==1){p2->next1=p1;
p2->next2=NULL;}
else {p2->next1=p1;
p2->next2=p3;}
p3=p2;
p1=(struct student *)malloc(LEN);
gets(p1->info);
p2=p1;
}
p3->next1=NULL;
return p3;
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
do{
printf("%s\n",p->info);
p=p->next2;
}while(p!=NULL);
}
int main()
{struct student *top;
top=creat();
print(top);
}
|
31
|
15,208 |
struct student
{
char num[100];
char name[100];
char gender;
int age;
float score;
char add[100];
struct student *next;
};
int n;
struct student *head=0;
struct student * creat(void)
{
struct student *p1,*p2;
n=0;
p1=p2=(struct student *) malloc(LEN);
while(strcmp(p1->num,"end")!=0)
{
n++;
if(n==1)
p2->next=0;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")!=0)
scanf("%s %c %d %f %s",p1->name,&p1->gender,&p1->age,&p1->score,p1->add);
}
head=p2;
return(head);
}
void main()
{
struct student *p;
p=creat();
if(p!=0)
do
{
printf("%s %s %c %d %g %s",p->num,p->name,p->gender,p->age,p->score,p->add);
p=p->next;
if(p->next!=0)
printf("\n");
} while(p->next!=0);
}
|
31
|
15,209 |
struct info{
char num[10];
char name[20];
char sex;
int age;
float grade;
char address[10];
struct info *link;
};
int main(){
struct info *p1,*p2;
p1=p2=NULL;
p1=(struct info *)malloc(sizeof(struct info));
scanf("%s",p1->num);
if(p1->num[0]=='e') return 0;
do{
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->address);
p1->link=p2;
p2=p1;
p1=(struct info *)malloc(sizeof(struct info));
scanf("%s",p1->num);
}while(p1->num[0]!='e');
while(p2!=NULL){
printf("%s %s %c %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->grade,p2->address);
p1=p2->link;
p2=p1;
}
return 0;
}
|
31
|
15,210 |
struct s
{
char a[100];
char b[100];
char c;
int d;
char e[100];
char f[100];
}k[1000];
int n;
int main(int argc, char *argv[])
{ int i;
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);
}
for(i=i-1;i>=0;i--)
printf("%s %s %c %d %s %s\n",k[i].a,k[i].b,k[i].c,k[i].d,k[i].e,k[i].f);
return 0;
}
|
31
|
15,211 |
void main()
{
int i=0, n=0;
char a[500][100];
for(i=0; i<500; i++)
{
gets(a[i]);
//getchar();
if(a[i][0]=='e') break;
}
n=i-1;
for(i=n; i>=0; i--)
{
printf("%s\n",a[i]);
}
}
|
31
|
15,212 |
main()
{
struct stu
{
char num[10];
char name[32];
char sex;
int age;
float score;
char address[32];
struct stu *next;
};
struct stu *p1,*p2;
p1=(struct stu *)malloc(len);
p1->next=NULL;
int i;
for(i=0;;i++)
{
scanf("%s",p1->num);
if(!strcmp(p1->num,"end"))
break;
scanf("%s %c %d %g %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
p2=(struct stu *)malloc(len);
p2->next=p1;
p1=p2;
}
p1=p1->next;
while(p1)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
p1=p1->next;
}
}
|
31
|
15,213 |
int main()
{
struct student
{
char s[500];
struct student *next;
}stu[2000],stup[2000];
int i=0,j;
struct student *p1,*p2,*head;
p1=p2=(struct student *)malloc(LEN);
head=NULL;
gets(p1->s);
while((*(p1->s)+0)!='e')
{
stu[i]=*p1;
if(++i==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->s);
}
p2->next=NULL;
for(j=0;j<i;j++) stup[j]=stu[i-1-j];
for(j=0;j<i;j++) printf("%s\n",stup[j].s);
return 0;
}
|
31
|
15,214 |
void main()
{
char *juzi[1000];
char **p;
p=juzi;
*p=(char *)malloc(100*sizeof(char));
gets(*p);
while(strcmp(*p,"end")!=0)
{
p++;
*p=(char *)malloc(100*sizeof(char));
gets(*p);
}
p--;
for(;p>=juzi;p--)
puts(*p);
}
|
31
|
15,215 |
struct stu
{
char num[15];
char name[20];
char sex;
int age;
char score[10];
char addr[15];
struct stu* next;
};
int main()
{
struct stu* p1,*p2;
p1=(struct stu*)malloc(len);
scanf("%s%s %c%d%s%s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
p1->next=NULL;
while(1)
{
p2=(struct stu*)malloc(len);
scanf("%s",p2->num);
if(p2->num[0]=='e')
break;
scanf("%s %c%d%s%s",p2->name,&p2->sex,&p2->age,p2->score,p2->addr);
p2->next=p1;
p1=p2;
}
while(p1!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->next;
}
return 0;
}
|
31
|
15,216 |
struct stu
{
char inf[50];
struct stu *next;
};
struct stu *head,*p1,*p2;
int output(struct stu *point);
int main()
{
p1=(struct stu *)malloc(sizeof(struct stu));
head=p1;
while(gets((*p1).inf)!=NULL)
{
p2=(struct stu *)malloc(sizeof(struct stu));
(*p1).next=p2;
p1=p2;
}
(*p1).next=NULL;
output(head);
return 0;
}
int output(struct stu *point)
{
if(strcmp(point->next->inf,"end")!=0)
output(point->next);
puts((*point).inf);
return 0;
}
|
31
|
15,217 |
void main()
{
char s[1000][100];
int i;
for(i=0;;i++)
{
gets(s[i]);
if(s[i][0]=='e')
{
i--;
break;
}
}
for(;i>=0;i--)
printf("%s\n",s[i]);
}
|
31
|
15,218 |
struct stu
{
char a[100];
struct stu * next;
};
struct stu * create()
{
struct stu *head,*p1,*p2;
p2=p1=(struct stu *) malloc (sizeof(struct stu));
gets(p1->a);
p1->next=0;
while(!(p1->a[0]==101&&p1->a[1]==110&&p1->a[2]==100))
{
p1=(struct stu *) malloc (sizeof(struct stu));
gets(p1->a);
p1->next=p2;
p2=p1;
}
return p1->next;
}
void print (struct stu *p)
{
while(p!=0)
{
printf("%s\n",p->a);
p=p->next;
}
}
int main()
{
struct stu *p;
p=create();
print(p);
return 0;
}
|
31
|
15,219 |
struct student
{char num[20];
char name[20];
char sex[2];
int old;
float grade;
char address[100];
struct student *next;
};
int main()
{
struct student *p1,*p2;
p1=p2=NULL;
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->num);
if(p1->num[0]=='e')
return 0;
do
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->old,&p1->grade,p1->address);
p1->next=p2;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
p1->next=p2;
scanf("%s",p1->num);
} while(p1->num[0]!='e');
while(p2!=NULL)
{
printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->old,p2->grade,p2->address);
p1=p2->next;
p2=p1;
}
return 0;
}
|
31
|
15,220 |
struct q
{
char a[100];
struct q *last;
};
struct q * c()
{
struct q *p1,*p2,*end;
int t=1;
while(0==0)
{
p1=(struct q *)malloc(sizeof(struct q));
gets(p1->a);
if(t==1)
{
p1->last=NULL;
p2=p1;
t=0;
}
else
{
if(p1->a[0]!='e')
{
p1->last=p2;
p2=p1;
}
else
{
end=p2;
break;
}
}
}
return end;
}
main()
{
struct q *p1;
p1=c();
while(p1!=NULL)
{
puts(p1->a);
p1=p1->last;
}
}
|
31
|
15,221 |
struct student
{
char num[200];
char name[100];
char xingbie;
int age;
char score[200];
char add[200];
struct student *next;
};
struct student*creat()
{
struct student *p1,*head;
p1=(struct student*)malloc(LEN);
head=NULL;
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0) return head;
scanf("%s %c %d %s %s",p1->name,&p1->xingbie,&p1->age,p1->score,p1->add);
while(1)
{
p1->next=head;
head=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
break;
else
scanf("%s %c %d %s %s",p1->name,&p1->xingbie,&p1->age,p1->score,p1->add);
}
return (head);
}
void main()
{
struct student *p;
p=creat();
while(p!=NULL)
{
if((strcmp(p->num,"end")==0)){p=p->next;continue;}
printf("%s %s %c %d %s %s\n",p->num,p->name,p->xingbie,p->age,p->score,p->add);
p=p->next;
};
}
|
31
|
15,222 |
struct stu
{char num[20];
char name[20];
char sex;
int age;
char score[10];
char adr[20];
struct stu *next;
};
int main(){
int n=0;
int i;
struct stu *head;
struct stu *p1,*p2,*re,*rehead;
p1=p2=(struct stu *)malloc(len);
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
head=null;
for(i=0;;i++){
n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct stu *)malloc(len);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0){
break;}
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
}
p2->next=null;
/* p1=head;
while(p1!=null){
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1=p1->next;
}*/
for(i=0;i<n;i++){
p2=p1=head;
while(p1->next!=null){
p2=p1;
p1=p1->next;
}
if(i==0)
re=rehead=p1;
else
re=re->next=p1;
p2->next=null;
}
p1=rehead;
while(p1!=null){
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1=p1->next;
}
return 0;
}
|
31
|
15,223 |
struct sa
{
char a[500];
struct sa *next;
};
int n;
struct sa *kao(void)
{
struct sa *head;
struct sa *p1,*p2;
n=0;
head=NULL;
p1=p2=(struct sa *)malloc(len);
gets(p1->a);
head=p1;
for(;;)
{
n++;
if(n==1)
p1->next=NULL;
else
{
p2=p1;
p1=(struct sa *)malloc(len);
p1->next=p2;
gets(p1->a);
}
if(strcmp(p1->a,"end")==0)
break;
}
head=p2;
return (head);
}
int main()
{
struct sa *p;
p=kao();
for(;p!=NULL;)
{
printf("%s\n",p->a);
p=p->next;
}
return 0;
}
|
31
|
15,224 |
int i=0;
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);
head=p1;
while (1)
{
i++;
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);
p2->next=p1;}
}
p2->next=NULL;
return (head);
}
/*struct shuju*create()
{
struct shuju *head,*p1,*p2;
p1=(struct shuju *)malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")!=0){
scanf("%s %c %d %d %s",p1->xm,&p1->sex,&p1->age,&p1->fen,p1->dorm);
p1->next=NULL;
head=p1;
p2=p1;
do
{
i++;
p1=(struct shuju* )malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")==0)
{
free(p1);break;
}
else
{
scanf("%s %c %d %d %s",p1->xm,&p1->sex,&p1->age,&p1->fen,p1->dorm);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
}
while(1);}
else{head=NULL;}
return(head);
}*/
void print(struct shuju* head)
{
int j;
struct shuju* p,*pre;
for (j=0;j<i;j++)
{
p=head;
pre=p;
while (p->next!=NULL)
{
pre=p;
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
pre->next=NULL;}
}
void main()
{
struct shuju *p;
p=create();
print(p);
}
|
31
|
15,225 |
struct student
{
char num[50];
char name[20];
char sex;
int year;
char score[10];
char add[50];
struct student *next;
};
int n;
struct student *Create()
{
struct student *head;
struct student *p1=NULL;
struct student *p2=NULL;
n = 0;
p1 = (struct student *)malloc(LEN);
p2 = p1;
head = NULL;
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->year,p1->score,p1->add);
int j=0;
for(;;j++)
{
n += 1;
if (n==1)
{
head = p1;
p2->next = NULL;
}
else
{
p2->next = p1;
}
p2 = p1;
p1 = (struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{
p2->next=NULL;
break;
}
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add);
}
p2->next = NULL;
free(p1);
p1 = NULL;
return head;
}
struct student *Reverse(struct student *head)
{
struct student *p;
struct student *p1;
struct student *p2;
p1 = NULL;
p2 = head;
while (p2 != NULL)
{
p = p2->next;
p2->next = p1;
p1 = p2;
p2 = p;
}
head = p1;
return head;
}
void Print(struct student *head)
{
struct student *p;
p = head;
if(head != NULL)
{
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add);
p = p->next;
}
while (p != NULL);
}
}
int main()
{
struct student *head;
head = Create();
head = Reverse(head);
Print(head);
return 0;
}
|
31
|
15,226 |
main()
{
int doit(int a);
doit(1);
}
int doit(int r)
{
char a[20],b[20],c[20],d[20],e[20],f[20];
scanf("%s",a);
if (a[0]!='e') { scanf("%s",b);scanf("%s",c);scanf("%s",d);scanf("%s",e);scanf("%s",f);
doit(1);}
else return 0;
printf("%s %s %s %s %s %s\n",a,b,c,d,e,f);
}
|
31
|
15,227 |
typedef struct node{
char id[100],name[100],sex[2],address[100],age[10],grade[10];
struct node *next;
}node;
node *head=NULL;
int create(){
node *p = (node*)malloc(sizeof(node));
scanf("%s",p->id);
if(p->id[0]=='e'){free(p);return 1;}
scanf("%s%s%s%s%s",p->name,p->sex,p->age,p->grade,p->address);
p->next = head;
head = p;
return 0;
}
void print(){
node *p = head,*temp;
for(;p!=NULL;){
printf("%s %s %s %s %s %s\n",p->id,p->name,p->sex,p->age,p->grade,p->address);
temp = p;
p = p->next;
free(temp);
}
}
int main()
{
int i,j,n,m,k;
for(;;){
if(create()==1)break;
}
print();
}
|
31
|
15,228 |
struct student
{
char num[100];
struct student *next;
};
main()
{
int n;
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->num);
while(p1->num[0]!='e')
{
n=n+1;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->num);
}
head=p2;
do
{
printf("%s\n",head->num);
head=head->next;
}while(head!=NULL);
}
|
31
|
15,229 |
struct student
{
char message[300];
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->message);
head=NULL;
while(strcmp(p1->message,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->message);
}
head->next=NULL;
return(p2);
}
void print(struct student *head)
{
struct student*p;
p=head;
if(head!=NULL)
do
{
printf("%s\n",p->message);
p=p->next;
}
while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,230 |
struct student
{
char xuehao[10];
char xingming[20];
char xingbie;
int nianling;
float chengji;
char dizhi[20];
struct student *next;
};
struct student *creat()
{
int n=0;
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
while(1)
{
scanf("%s",p1->xuehao);
if(p1->xuehao[0]=='e')
{head=p2;
break;}
scanf("%s %c %d %f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->chengji,p1->dizhi);
if(n==0) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
n++;
}
return head;
}
int main()
{
struct student *p;
p=creat();
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->chengji,p->dizhi);
p=p->next;
}
return 0;
}
|
31
|
15,231 |
struct student
{
char a[10];
char b[20];
char c;
int d;
float e;
char f[19];
struct student * next;
};
int main()
{
struct student *p1,*p2;
p1=(struct student *)malloc(len);
scanf("%s %s %c %d %f %s",p1->a,p1->b,&p1->c,&p1->d,&p1->e,p1->f);
p1->next=NULL;
p2=p1;
while(1)
{
p1=(struct student *)malloc(len);
scanf("%s",p1->a);
if(strcmp(p1->a,"end")==0)
break;
scanf("%s %c %d %f %s",p1->b,&p1->c,&p1->d,&p1->e,p1->f);
p1->next=p2;
p2=p1;
}
p1=p2;
while(p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
p1=p1->next;
}
return 0;
}
|
31
|
15,232 |
struct a
{
struct a*back;
char a[20];
char b[20];
char c;
int d;
char e[20];
char f[20];
struct a*next;
};
int main()
{
struct a *pHeader,*pEnd,*p1;
pHeader=(struct a*)malloc(sizeof(struct a));
pHeader->back=NULL;
p1=pHeader;
struct a*p;
char g;
for(;;)
{
p=(struct a*)malloc(sizeof(struct a));
scanf("%s",p->a);
g=*p->a;
if(g=='e')
{
pEnd=p;
p->back=p1;
p1->next=p;
p->next=NULL;
break;
}
p->back=p1;
p1->next=p;
p1=p;
scanf("%s %c %d %s %s",p->b,&p->c,&p->d,&p->e,p->f);
}
printf("%s %s %c %d %s %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
p=pEnd;
for(;;)
{
printf("%s %s %c %d %s %s\n",p1->back->a,p1->back->b,p1->back->c,p1->back->d,p1->back->e,p1->back->f);
p1=p1->back;
free(p1->next);
if(p1->back->back==NULL) break;
}
}
|
31
|
15,233 |
struct student
{
char num[9];
char name[20];
char sex;
int age;
float grade;
char address[20];
struct student *next;
};
void main()
{
int n=1,i;
struct student *thisnode,*newnode,*p;
for(i=1;;i++)
{
newnode=(struct student *)malloc(LEN);
scanf("%s",newnode->num);
if(newnode->num[0]=='e') break;
scanf("%s %c %d %g %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address);
if(n==1)
{
newnode->next=NULL;
thisnode=newnode;
}
else
{
newnode->next=thisnode;
thisnode=newnode;
}
n++;
}
p=thisnode;
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
p=p->next;
}
}
|
31
|
15,234 |
struct stu{
char name[20];
char num[10];
char x[5];
int y;
float f;
char add[100];
struct stu *next;
};
int main()
{
struct stu *p1,*p2;
p1=(struct stu *)malloc(sizeof(struct stu));
p1->next=0;
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
scanf("%s%s%d%f%s",p1->name,p1->x,&p1->y,&p1->f,p1->add);
p2=p1;
p1=(struct stu *)malloc(sizeof(struct stu));
p1->next=p2;
scanf("%s",p1->num);
}
p1=p1->next;
printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->x,p1->y,p1->f,p1->add);
while(p1->next!=0)
{
p1=p1->next;
printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->x,p1->y,p1->f,p1->add);
}
return 0;
}
|
31
|
15,235 |
struct student
{char num[1000];
struct student *next;
};
void main()
{struct student *head,*p1,*p,*p2,*end;
int n=0;
p=p1=p2=(struct student*)malloc(LEN);
gets(p1->num);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{n=n+1;
head=p1;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->num);
}
p=head;
if (head != NULL)
{do
{puts(p->num);
p=p->next;}
while(p != NULL);}
}
|
31
|
15,236 |
struct student
{
char num[20],name[20],dizhi[20],xb;
int year;
float score;
struct student *next,*pre;
};
struct student *create()
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf(TYPE,p1->num,p1->name,&p1->xb,&p1->year,&p1->score,p1->dizhi);
head=p1;
p1->pre=NULL;
p2=p1;
while(1)
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{
free(p1);
break;
}
scanf("%s %c %d %f %s",p1->name,&p1->xb,&p1->year,&p1->score,p1->dizhi);
p2->next=p1;
p1->pre=p2;
p2=p1;
}
p2->next=NULL;
return p2;
}
int main()
{
struct student *head,*p;
head=create();
p=head;
while(p!=NULL)
{
printf("%s %s %c %d %g %s",p->num,p->name,p->xb,p->year,p->score,p->dizhi);
printf("\n");
p=p->pre;
}
return 0;
}
/*????????????????????*/
|
31
|
15,237 |
struct stu
{
char inf[50];
struct stu *next;
} a[500];
int main()
{
// struct stu *head,*point;
int sum=0,i=0,j;
// point=(struct stu *)malloc(sizeof(struct stu));
while(gets(a[i].inf)!=NULL)
{
i++;
}
for(j=i-2;j>=0;j--)
{
puts(a[j].inf);
}
return 0;
}
|
31
|
15,238 |
struct student
{
char num[20];
char name[20];
char sex;
int age;
char score[50];
char add[20];
struct student *before;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
p1=(struct student* )malloc(len);
p1->before=NULL;
p2=p1;
do
{
scanf("%s",p1->num);
if(p1->num[0]=='e')
{
head=p2;
free(p1);
return(head);
}
else
{
scanf("%s %c %d %s",p1->name,&p1->sex,&p1->age,p1->score);
scanf("%s",p1->add);
p2=p1;
p1=(struct student*)malloc(len);
p1->before=p2;
}
}
while(1);
}
void main()
{
struct student *head1=creat();
struct student *q=head1;
while(q!=NULL)
{ printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->add);
q=q->before;
}
}
|
31
|
15,239 |
struct stu
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char adr[15];
struct stu *next;
}student;
int i;
struct stu *creat(void)
{
struct stu *p1,*p2,*head;
p1=p2=(struct stu *) malloc(sizeof (struct stu));
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
head=0;
i=0;
while(1)
{
if(i==0)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct stu *) 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->adr);
i++;
}
return(head);
}
void main()
{
struct stu *p,*head;
int j;
head=creat();
for(;i>0;i--)
{
p=head;
for(j=0;j<i;j++)
{
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr);
}
printf("%s %s %c %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->adr);
}
|
31
|
15,240 |
struct Student
{
char num[50];
char name[50];
char x;
int age;
float score;
char ad[50];
struct Student *next;
};
struct Student *create(void)
{
struct Student *head,*p1,*p2;
int n=0;
char end[5]="end\0";
p1=(struct Student*)malloc(LEN);
p2=p1;
scanf("%s",p1->num);
scanf("%s %c%d%f%s",p1->name,&p1->x,&p1->age,&p1->score,p1->ad);
head=NULL;
for(;;)
{
n=n+1;
if(n==1)head=p1;
else p1->next=head;
head=p1;
p1=(struct Student*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,end)==0)break;
scanf("%s %c%d%f%s",p1->name,&p1->x,&p1->age,&p1->score,p1->ad);
}
p2->next=NULL;
return(head);
}
void print(struct Student *head)
{ struct Student *p;
p=head;
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->x,p->age,p->score,p->ad);
p=p->next;
};
}
main()
{
struct Student *pt;
pt=create();
print(pt);
}
|
31
|
15,241 |
typedef struct node
{
char s[100];
struct node *next;
}node;
int main()
{
node *p1,*p2,*head;
head=(node*)malloc(sizeof(node));
p1=head;
p2=head;
int i=0;
while(1)
{
p2=(node*)malloc(sizeof(node));
if(i==0)
p2->next=NULL;
else
p2->next=p1;
p1=p2;
gets(p2->s);
if(strcmp(p2->s,"end")==0)
break;
head->next=p2;
i=1;
}
p1=head->next;
while(p1!=NULL)
{
printf("%s\n",p1->s);
p1=p1->next;
}
return 0;
}
|
31
|
15,242 |
main()
{
struct student
{
char num[100];
char name[100];
char sex[10];
char age[10];
char score[10];
char address[100];
struct student *next;
};
struct student *head,*p1;
p1=(struct student*)malloc(sizeof(struct student));
head=NULL;
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->address);
p1->next=head;
head=p1;
p1=(struct student*)malloc(sizeof(struct student));
scanf("%s",p1->num);
}
p1=head;
while(p1!=NULL)
{
printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
p1=p1->next;
}
}
|
31
|
15,243 |
int main()
{
struct student{
char number[20];
char name[20];
char sex;
int age;
float score;
char address[20];
struct student *fomer;
struct student *next;
};
struct student *head,*p,*wei;
int i,j;
head=(struct student *)malloc(sizeof(struct student));
p=head;
p->fomer=NULL;
if (p==NULL)
{
printf("fail!!!");
exit(-1);
}
scanf("%s%s %c %d%f%s",&p->number,&p->name,&p->sex,&p->age,&p->score,&p->address);
for (i=1;i<=1000;i++)
{
p->next=(struct student *)malloc(sizeof(struct student));
p->next->fomer=p;
p=p->next;
scanf("%s%s %c %d%g%s",&p->number,&p->name,&p->sex,&p->age,&p->score,&p->address);
//printf("%s %s %c %d %g %seeererrtttre\n",p->fomer->number,p->fomer->name,p->fomer->sex,p->fomer->age,p->fomer->score,p->fomer->address);
if (*p->number=='e')
{
p->fomer->next=NULL;
wei=p->fomer;
//printf("%s %s %c %d %g %s\n",wei->number,wei->name,wei->sex,wei->age,wei->score,wei->address);
break;
}
}
//printf("%s %s %c %d %g %s\n",wei->number,wei->name,wei->sex,wei->age,wei->score,wei->address);
p=wei;
for (;p!=NULL;)
{
printf("%s %s %c %d %g %s\n",p->number,p->name,p->sex,p->age,p->score,p->address);
p=p->fomer;
}
}
|
31
|
15,244 |
struct student{
char num[50];
char name[50];
char sex[50];
char age[50];
char score[50];
char adr[50];
struct student *next;
};//?????????????
int main(){
struct student *p1,*p2,*head;
p1=(struct student *)malloc(LEN);
int i=0;
p2=NULL;
for(;;i++)
{
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{//??p1->num?????
break;
}
scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1->next=p2;
p2=p1;
}
head=p2;
if(head!=NULL)
{
p1=head;
do{
printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1=p1->next;
}while(p1!=NULL);
}
return 0;
}
|
31
|
15,245 |
struct Student
{
char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct Student *next;
struct Student *front;
};
int n;
void main()
{
struct Student*p1,*p2;
struct Student*head;
n=0;
p1=p2=(struct Student*)malloc(LEN);
scanf("%s %s %c%d%s%s",p1->number,p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->front=NULL;
while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
{
n=n+1;
if(n==1)head=p1;
else
{
p2=p1;
p1=(struct Student*)malloc(LEN);
scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
p1->front=p2;
}
}
while(p2!=NULL)
{
printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address);
p2=p2->front;
}
}
|
31
|
15,246 |
char a[]="end";
struct student
{
struct student *last;
char num[50];
char name[50];
char sex;
int age;
char grade[50];
char address[50];
struct student *next;
};
struct student *Appendnewnode()
{
struct student *head=NULL, *newnode, *thisnode,*end;
int i=0;
do
{
newnode=(struct student *)malloc(sizeof(struct student));
if(newnode==NULL)
{
printf("Memory request failed!");
exit(-1);
}
scanf("%s",newnode->num);
if(strcmp(newnode->num,a)!=0)
scanf("%s %c %d %s %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address);
if(i==0)
{
head=newnode;
thisnode=head;
newnode->last=NULL;
if(strcmp(newnode->num,a)!=0)
newnode->next=NULL;
i++;
}
else
{
thisnode->next=newnode;
newnode->last=thisnode;
if(strcmp(newnode->num,a)!=0)
thisnode=newnode;
}
}while(strcmp(newnode->num,a)!=0);
end=thisnode;
thisnode->next=NULL;
return(end);
}
void main()
{
struct student *end, *p;
end=Appendnewnode();
for(p=end;p->last!=NULL;p=p->last)
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
}
|
31
|
15,247 |
struct student
{
struct student *pre;
char mess[500];
};
void main()
{
int n=0;
struct student *p1,*p2,*p;
p1=(struct student *)malloc(LEN);
while(strcmp(gets(p1->mess),"end")!=0)
{
n=n+1;
if(n==1)
p1->pre=NULL;
else
p1->pre=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
}
p=p2;
do
{
printf("%s\n",p->mess);
p=p->pre;
}while(p!=NULL);
}
|
31
|
15,248 |
struct student
{char num[20];
char name[20];
char sex;
int age;
char grade[20];
char address[20];
struct student *next;
};
int n;
struct student *create(void)
{
struct student *head;
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->grade,&p1->address);
for(n=0;p1->sex=='f' || p1->sex=='m' ;n++)
{
if(n==0) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->grade,&p1->address);
}
head=p2;
return(head);
}
void print(struct student *head)
{
struct student *p;
if (head!=NULL)
for (p=head;p!=NULL;p=p->next)
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
}
void main()
{
struct student *head;
head=create();
print(head);
}
|
31
|
15,249 |
struct Student
{
char id[200];
char name[200];
char sex[1];
int age;
float mark;
char address[200];
struct Student *next;
};
int main()
{
struct Student *p, *head, *tail;
head = tail = NULL;
while(1)
{
p = (struct Student *) malloc(LEN);
scanf("%s", p->id);
if(p->id[0] == 'e')
break;
scanf("%s", p->name);
scanf("%s", p->sex);
scanf("%d%f%s", &p->age, &p->mark, p->address);
p->next = NULL;
if(head == NULL)
head = tail = p;
else
{
p->next = head;
head = p;
}
}
p = head;
while(p != NULL)
{
printf("%s ", p->id);
printf("%s ", p->name);
printf("%s ", p->sex);
printf("%d %g ", p->age, p->mark);
printf("%s\n", p->address);
p = p->next;
}
return 0;
}
|
31
|
15,250 |
struct info
{
char id[30];
char name[30];
char gen;
int age;
float grade;
char add[30];
struct info *next;
};
int n;
struct info *creat(void)
{
struct info *head;
struct info *p1;
n=0;
head=p1=(struct info*)malloc(LEN);
scanf("%s",&p1->id);
while(strcmp(p1->id,"end"))
{ scanf("%s %c %d %f %s",&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
n=n+1;
if(n==1) {head=p1;p1->next=NULL;}
else p1->next=head;
head=p1;
p1=(struct info*)malloc(LEN);
scanf("%s",&p1->id);
};
return(head);
}
void print(struct info *head)
{
struct info *p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %g %s\n",p->id,p->name,p->gen,p->age,p->grade,p->add);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct info *head;
head=creat();
print(head);
}
|
31
|
15,251 |
char ss[]={'e','n','d'};
int n=0;
struct st
{
char s[200];
struct st *next1;
};
void main()
{
struct st *p;
struct st *creat(void);
int i=0;
struct st *head;
struct st *p1,*p2;
p1=p2=(struct st *)malloc(len);
p1->next1=NULL;
gets(p1->s);
head=p1;
while(1)
{
n++;
if(n==1)head=p1;
p2=p1;
p1=(struct st *)malloc(len);
gets(p1->s);
p1->next1=p2;
if(strcmp(p1->s,ss)==0)
{
break;
}
}
head->next1=NULL;
for(i=0;i<n;i++)
{
printf("%s\n",p2->s);
p2=p2->next1;
}
}
|
31
|
15,252 |
struct student
{
char num[20];
char name[100];
char sex;
int age;
char score[10];
char address[20];
struct student *next;
};
struct student *print()
{
struct student *head=NULL,*node;
do
{
node=(struct student*)malloc(sizeof(struct student));
scanf("%s",node->num);
if(strcmp(node->num,"end")==0)
break;
else
{
scanf("%s %c %d %s %s",node->name,&node->sex,&node->age,node->score,node->address);
node->next=head;
head=node;
}
}
while(1);
return head;
}
void main()
{
struct student *p;
p=print();
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->next!=NULL);
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
}
|
31
|
15,253 |
struct stu
{char id[16];
char name[32];
char gender;
int age;
char score[8];
char add[16];
struct stu*next;
};
int n;
struct stu*creat(void)
{struct stu *head,*p1,*p2;
n=0;
head=NULL;
p1=p2=(struct stu*)malloc(sizeof(struct stu));
scanf("%s",p1->id);
while(strcmp(p1->id,"end")!=0)
{scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->add);
n=n+1;
if(n==1) {head=p1;p1->next=NULL;}
else
{
p1->next=p2;
head=p1;
}
p2=p1;
p1=(struct stu*)malloc(sizeof(struct stu));
scanf("%s",p1->id);
}
return(head);
}
void main()
{struct stu*head,*p;
head=creat();
p=head;
if(head!=NULL)
do
{printf("%s %s %c %d %s %s\n",p->id,p->name,p->gender,p->age,p->score,p->add);
p=p->next;
}while(p!=NULL);
}
|
31
|
15,254 |
struct xs
{
char num[10];
char name[30],sex[2],adr[100],grade[20];
int year;
struct xs *next;
};
struct xs *creat()// ?0?7?0?9×?0?0·?0?4 ?0?3?0?1 NULL ?0?4?0?1?0?7à?0?6?0?0?0?8?0?5?0?8×?0?8?0?1?0?0·
{
struct xs *head,*p1,*p2;
p1=p2=(struct xs *)malloc(LEN);
head=NULL;
p1->next=NULL;
int n=0;
while(1)
{
n++;
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0){
if(n==1)return NULL;
else break;
}
SCAN;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct xs*)malloc(LEN);
}
p2->next=NULL;
return head;
}
void output(struct xs* head)//?0?8×?0?8?0?1?0?0·NULL ?0?8?0?1?0?6?0?2?0?3?0?1?0?6?0?8?0?3?0?5
{
struct xs *p=head;
if(p==NULL)printf("\n");
else do
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->year,p->grade,p->adr);
p=p->next;
}
while(p!=NULL);
}
struct xs * change(struct xs*head)//?0?8×?0?8?0?1?0?0· NULL ?0?3?0?1 NULL
{
struct xs *p1,*p2,*p3;
if(head==0)
return 0;
p1=NULL;
p2=head;
p3=p2->next;
while(1)
{
p2->next=p1;
if(p3==NULL){
head=p2;
p2->next=p1;
break;
}
else {
p1=p2;
p2=p3;
p3=p3->next;
}
}
return head;
}
int main()
{
struct xs *head;
head=creat();
head=change(head);
output(head);
getchar();
getchar();
return 0;
}
|
31
|
15,255 |
int n=0;
struct student
{
char s[200];
struct student *next;
};
struct student *creat()
{
char k[200];
struct student *p,*head;
head=p=(struct student *)malloc(LEN);
while(1)
{
gets(k);
if(!(strcmp(k,"end")))
break;
else
{
if(n==0)
{head->next=NULL;n=1;}
else
p->next=head;
head=p;
strcpy(p->s,k);
p=(struct student *)malloc(LEN);
}
}
free(p);
return (head);
}
void print(struct student *p)
{
if(p!=NULL)
{
puts(p->s);
print(p->next);
}
}
int main()
{
struct student *head;
head=creat();
print(head);
return 0;
}
|
31
|
15,256 |
int num=0;
void main()
{
struct student
{
char xh[100];
char xm[100];
char xb;
int nl;
float df;
char dz[100];
struct student *af;
struct student *bf;
};
int i,j,k,m,n;
struct student *p1,*p2,*p3,*p4,*head;
p1=p2=(struct student *)malloc(sizeof(struct student));
scanf("%s %s %c %d %f %s",p1->xh,p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p1->bf=0;
while(strcmp(p2->xh,"end")!=0)
{
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->xh);
if(strcmp(p1->xh,"end")==0)
{
head=p2;
p1->bf=p2;
p2->af=p1;
p2=p1;
num++;
p1->af=0;
break;
}
scanf("%s %c %d %f %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p1->bf=p2;
p2->af=p1;
p2=p1;
num++;
}
//if(strcmp(p1->xh,"end")==0)p1->af=0;
//printf("%d",num);
p1=head;
//printf("%c",p1->xb);
for(i=0;i<num;i++)
{
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,257 |
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[20];
char address[50];
struct student *next;
};
void main()
{
struct student *p,*head,*q;
p=(struct student*)calloc(1000,sizeof(struct student));
int i,k;
for(i=0;;i++)
{
scanf("%s",p[i].num);
if(p[i].num[0]=='e')
break;
scanf("%s %c %d %s %s",p[i].name,&p[i].sex,&p[i].age,p[i].score,p[i].address);
}
k=i-1;
head=&p[k];
for(i=k;i>=1;i--)
p[i].next=&p[i-1];
p[0].next=NULL;
q=head;
do
{
printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->address);
q=q->next;
}
while(q!=NULL);
}
|
31
|
15,258 |
struct student
{ char id[100];
char name[100];
char sex;
int age;
char score[100];
char adress[100];
struct student *next;
struct student *formal;
};
int n;
int main ()
{ struct student *head,*p1,*p2;
n=0;
int i=0;
p1=p2=(struct student*)malloc(len);
head=NULL;
while(0==0)
{ n=n+1;
scanf("%s ",p1->id);
if((*p1).id[0]=='e') break;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,
p1->adress);
if(n==1) {head=p1;
p1->formal=NULL;}
else {p2->next=p1;
p1->formal=p2;}
p2=p1;
p1=(struct student*) malloc(len);
}
p2->next=NULL;
while (0==0)
{ printf("%s %s %c %d %s %s\n",p2->id,p2->name,p2->sex,p2->age,p2->score,
p2->adress);
if(p2->formal==NULL) break;
p2=p2->formal;
}
return 0;
}
|
31
|
15,259 |
int main()
{
struct student
{
char a[20];
char b[20];
char c[20];
char d[20];
char e[20];
char f[20];
struct student *pNext;
};
struct student *pHeader = (struct student *)malloc(sizeof(struct student));
pHeader->pNext=NULL;
struct student *p;
while(1)
{
p=(struct student *)malloc(sizeof(struct student));
p->pNext=pHeader->pNext;
pHeader->pNext=p;
scanf("%s",p->a);
if(p->a[0]=='e') break;
scanf("%s %s %s %s %s",p->b,p->c,p->d,p->e,p->f);
}
p=pHeader->pNext->pNext;
while(1)
{
if(p==NULL) break;
printf("%s %s %s %s %s %s\n",p->a,p->b,p->c,p->d,p->e,p->f);
p=p->pNext;
}
}
|
31
|
15,260 |
struct student
{
struct student *next;
char num[20];
char name[20];
char sex[2];
int age;
float score;
char address[40];
};
struct student *creat()
{
struct student *head,*p1,*p2;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")!=0)
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->address);
p2=p1;
p2->next=NUL;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
scanf("%s%s",p1->name,p1->sex);
scanf("%d%f%s",&p1->age,&p1->score,p1->address);
p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
}
head=p2;
}
else
head=NUL;
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
while(p!=NUL)
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
}
int main()
{
struct student *head;
head=creat();
print(head);
return 0;
}
|
31
|
15,261 |
struct student
{
char inf[100];
struct student *next;
struct student *last;
};
int n;
struct student *end;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->inf);
head=NULL;
while(1)
{
n=n+1;
if(n==1)head=p1;
else {p2->next=p1;p1->last=p2;}
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->inf);
if((p1->inf)[0]=='e') break;
}
head->last=NULL;
p2->next=NULL;
end=p2;
return(head);
}
main()
{
struct student *head;
struct student *p1,*p2;
head=creat();
p1=end;
while(p1!=NULL)
{
p2=p1;
puts(p1->inf);
p1=p2->last;
}
}
|
31
|
15,262 |
struct node{
char str[MAX];
struct node *next;
}*head;
void main()
{
struct node *p1,*p2,*p;
p1=p2=(struct node *)malloc(LEN);
gets(p1->str);
p1->next=0;
while(strcmp( p1->str , "end" )!=0){
p1=(struct node *)malloc(LEN);
gets(p1->str);
p1->next=p2;
head=p2;
p2=p1;
}
p=head;
while(p!=0){
puts(p->str);
p=p->next;
}
}
|
31
|
15,263 |
struct student{
char num[100];
char name[100];
char sex;
int old;
float score;
char add[150];
struct student *next;
};
void main()
{
struct student *p1,*p2;
int len=sizeof(struct student);
p1=(struct student *)malloc(len);
p1->next=NULL;
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0){
scanf("%s %c %d %g %s",p1->name,&p1->sex,&p1->old,&p1->score,p1->add);
p2=p1;
p1=(struct student *)malloc(len);
p1->next=p2;
scanf("%s",p1->num);
}
while(p1->next!=NULL){
p1=p1->next;
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->old,p1->score,p1->add);
}
}
|
31
|
15,264 |
struct student
{
struct student *last;
char a[100];
};
int main ()
{
// freopen ( "1.in" , "r" , stdin );
// freopen ( "1.out" , "w" , stdout );
char a[100];
struct student *p , *p1;
p = p1 = ( struct student * ) malloc ( sizeof ( struct student ) );
p1->last = NULL;
gets ( p1->a );
for ( ; ; )
{
gets ( a );
if ( strcmp ( a , "end" ) == 0 ) break;
p = ( struct student * ) malloc ( sizeof ( struct student ) );
strcpy ( p->a , a );
p->last = p1;
p1 = p;
}
for ( ; ; )
{
printf ( "%s" , p->a );
p = p->last;
if ( p == NULL ) break;
else printf ( "\n" );
}
return 0;
}
|
31
|
15,265 |
void main()
{
struct li
{
char num[20],k[1000];
struct li *next,*up;
}*head,*p;
head=(struct li *)malloc(sizeof(struct li));
p=head;
for(;;)
{
scanf("%s",p->num);
if(p->num[0]=='e')
break;
gets(p->k);
p->next=(struct li *)malloc(sizeof(struct li));
(p->next)->up=p;
p=p->next;
}
p=p->up;
while(p!=head)
{
printf("%s%s\n",p->num,p->k);
p=p->up;
}
printf("%s%s\n",head->num,head->k);
}
|
31
|
15,266 |
struct student
{
char num[100];
char name[30];
char sex;
int age;
float grade;
char adress[30];
struct student *next;
struct student *before;
};
int n;
struct student *creat(void)
{
struct student *head,*end;
struct student *p1,*p2;
char str[5]={"end"};
n=0;
p1=p2=( struct student *)malloc(LEN);
scanf("%s %s %c %d %g %s",&p1->num,p1->name,&p1->sex,&p1->age,&p1->grade,p1->adress);
head=NULL;
do
{
n=n+1;
if(n==1) {head=p1;p1->before=NULL;}
else
{
p2->next=p1;
p1->before=p2;
}
p2=p1;
p1=( struct student *)malloc(LEN);
scanf("%s",&p1->num);
if(strcmp(p1->num,str)==0)
break;
scanf("%s %c %d %g %s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->adress);
}while(n<1000);
end=p2;
p2->next=NULL;
return (end);
}
void print(struct student *end)
{
struct student *p;
p=end;
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->adress);
p=p->before;
}while(p!=NULL);
}
void main()
{
struct student *end;
end=creat();
print(end);
}
|
31
|
15,267 |
struct stu
{
char num[100];
char name[100];
char sex[3];
char age[10];
char score[10];
char ad[100];
struct stu*next;
struct stu*pre;
};
int main(int argc, char* argv[])
{
int cal=0,i=0;
char end[100];
struct stu*head,*p1,*p2;
p1=(struct stu*)malloc(len);
scanf(" %s %s %s %s %s %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->ad);
p1->next=NULL;
p1->pre=NULL;
head=p1;
p2=p1;
while(1)
{
scanf("%s",end);
if(end[0]=='e')
{break;}
p1=(struct stu*)malloc(len);
strcpy(p1->num,end);
scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->ad);
cal++;
p1->next=NULL;
p1->pre=p2;
p2->next=p1;
p2=p1;
}
while(p2)
{
printf("%s %s %s %s %s %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->ad);
p1=p2;
p2=p2->pre;
free(p1);
}
return 0;
}
|
31
|
15,268 |
struct student
{
char info[100];
struct student *next;
};
int n;
struct student*creat(void)
{struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
gets(p1->info);
p1->next=null;
while(strcmp("end",p1->info)!=0)
{head=p1;
p1=(struct student*)malloc(LEN);
p1->next=p2;
p2=p1;
gets(p1->info);
}
return(head);
}
void print(struct student*head)
{struct student*p;
p=head;
while(p!=null)
{printf("%s\n",p->info);
p=p->next;
}
}
main()
{struct student*head;
head=creat();
print(head);
}
|
31
|
15,269 |
struct stud
{
char num[20];
char name[20];
char sex;
int age;
char grade[10];
char add[30];
struct stud *next;
};
struct stud *creat(void)
{
struct stud *head,*p1,*p2;
p1=p2=(struct stud *)malloc(sizeof(struct stud));
p2->next=0;
head=p1;
for(;;)
{
scanf("%s",p1->num);
if(*(p1->num+2)=='d')
return head;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
p1=(struct stud *)malloc(sizeof(struct stud));
head=p2;
p1->next=p2;
p2=p1;
}
}
void print(struct stud *head)
{
struct stud *p;
for(p=head;p!=0;p=p->next)
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add);
}
void main()
{
struct stud *head;
head=creat();
print(head);
}
|
31
|
15,270 |
struct student
{ char num[20];
char name[20];
char sex;
int age;
double score;
char add[100];
struct student*next;
}*head,*p1;
void main()
{
int n=0;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
scanf("%s %c%d%lf%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
n++;
if(n==1)p1->next=NULL;
else p1->next=head;
head=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
}
p1=head;
do
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
while(p1!=NULL);
}
|
31
|
15,271 |
struct student
{
char a[100];
struct student * next;
}*p1,*p2,*head;
int main()
{
int n=0;
p1=p2=(struct student *)malloc(Len);
gets(p1->a);
p2->next=NULL;
while(1)
{
p1=(struct student *)malloc(Len);
gets(p1->a);
p1->next=p2;
if(strcmp(p1->a,"end")==0)
{
head=p1->next;
break;
}
else
{
p2=p1;
}
}
p1=head;
while(p1)
{
printf("%s\n",p1->a);
p1=p1->next;
}
}
|
31
|
15,272 |
struct student
{
char num[10];
char s1[20];
char sex;
int age;
char mark[20];
char s2[20];
struct student*next;
} *p1,*p2;//????????????????????????//
int n;
//????//
struct student * creat(void)
{
struct student * head;
n=0;
p1 = p2 = (struct student * )malloc(LEN);
scanf("%s", p1->num);
while(strcmp(p1->num,"end")!=0)//?????????//
{
scanf ("%s %c %d %s %s", p1->s1,&p1->sex, &p1->age, p1->mark, p1->s2);//?????????????//
n=n+1;
if (n==1)
{
head=p1;//?????????//
}
else
{
p2->next=p1;
}
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);//??p1->num???while?????//
}
p2->next=NULL;
return(head);
}//?????????????//
struct student * turnback(struct student * head)//??????//
{
struct student * newhead = NULL;
struct student * anew;//?????????????????//
do{
p2 = NULL;
p1 = head;
while(p1->next !=NULL)
{
p2=p1;
p1=p1->next;
}
if(newhead==NULL)
{
newhead = p1;
anew = newhead->next = p2;//??anew????????//
}
anew = anew->next =p2;
p2->next=NULL;
}while(head->next !=NULL);
return newhead;//??????????//
}
//??????//
void print(struct student *head)
{
struct student *p;
p = head;
if(p !=NULL)
do{
printf("%s %s %c %d %s %s\n", p->num, p->s1, p->sex, p->age, p->mark, p->s2);
p = p->next;
}while(p !=NULL);
}
//???//
main()
{
struct student *head;
head = creat();
head = turnback(head);//?????????????//
print (head);//??????????/
return 0;
}
|
31
|
15,273 |
struct student
{
char number[30];
char name[30];
char gender;
int age;
char score[30];
char add[30];
};
int main()
{
int lengthofnumber[505]={0},lengthofname[505]={0},lengthofadd[505]={0},lengthofscore[505]={0};
int i,j,numberofstudent=0;
struct student stu[505];
for(i=0;i<505;i++)
{//read
for(j=0;j<30;j++)
{//number
scanf("%c",&stu[i].number[j]);
if(stu[i].number[j]==' '||stu[i].number[j]=='d')
{
break;
}
else
{
lengthofnumber[i]+=1;
}
}//number
if(stu[i].number[2]=='d')
{
break;
}
else
{
numberofstudent+=1;
}
for(j=0;j<30;j++)
{//name
scanf("%c",&stu[i].name[j]);
if(stu[i].name[j]==' ')
{
break;
}
else
{
lengthofname[i]+=1;
}
}//name
scanf("%c",&stu[i].gender);
getchar();
scanf("%d",&stu[i].age);
getchar();
for(j=0;j<30;j++)
{//score
scanf("%c",&stu[i].score[j]);
if(stu[i].score[j]!=' ')
{
lengthofscore[i]+=1;
}
else
{
break;
}
}//score
for(j=0;j<30;j++)
{//add
scanf("%c",&stu[i].add[j]);
if(stu[i].add[j]!='\n')
{
lengthofadd[i]+=1;
}
else
{
break;
}
}//add
}//read
i=numberofstudent-1;
while(i!=0)//for(i=numberofstudent-1;i==0;i--)
{
for(j=0;j<lengthofnumber[i];j++)
{
printf("%c",stu[i].number[j]);
}
printf(" ");
for(j=0;j<lengthofname[i];j++)
{
printf("%c",stu[i].name[j]);
}
printf(" ");
printf("%c ",stu[i].gender);
printf("%d ",stu[i].age);
for(j=0;j<lengthofscore[i];j++)
{
printf("%c",stu[i].score[j]);
}
printf(" ");
for(j=0;j<lengthofadd[i];j++)
{
printf("%c",stu[i].add[j]);
}
printf("\n");
i--;
}
for(j=0;j<lengthofnumber[0];j++)
{
printf("%c",stu[0].number[j]);
}
printf(" ");
for(j=0;j<lengthofname[0];j++)
{
printf("%c",stu[0].name[j]);
}
printf(" ");
printf("%c ",stu[0].gender);
printf("%d ",stu[0].age);
for(j=0;j<lengthofscore[0];j++)
{
printf("%c",stu[0].score[j]);
}
printf(" ");
for(j=0;j<lengthofadd[0];j++)
{
printf("%c",stu[0].add[j]);
}
return 0;
}
|
31
|
15,274 |
struct student
{
char information[200];
struct student *next;
};
struct student *creat(void)
{
int n=0;
struct student *head;
struct student *p1,*p2;
p1=(struct student *)malloc(LEN);
gets(p1->information);
p1->next=NULL;
p2=p1;
do
{
p1=(struct student *)malloc(LEN);
gets(p1->information);
if(strcmp(p1->information,"end")==0)
{
free(p1);
head=p2;
break;
}
else
{
p1->next=p2;
head=p1;
p2=p1;
}
}
while(1);
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
{
do
{
puts(p->information);
p=p->next;
}
while(p!=NULL);
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15,275 |
struct Stu
{
char num[20];
char name[50];
char sex;
int age;
char mark[50];
char add[50];
struct Stu *link;
};
void main()
{
struct Stu *p1,*p2;
p1=(struct Stu *)malloc(LEN);
p2=p1;
scanf("%s",p1->num);
p1->link=NULL;
while(strcmp(p1->num,"end")!=0)
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->mark,p1->add);
p1=(struct Stu *)malloc(LEN);
p1->link=p2;
scanf("%s",p1->num);
p2=p1;
}
struct Stu *p;
p=p1->link;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
p1=p->link;
free(p);
p=p1;
}
}
|
31
|
15,276 |
/*
* tongjixueshengxinxi.cpp
*
* Created on: 2011-12-18
* Author: 1100012857
*/
int main(void)
{
struct student
{
char stunum[100];
char stuname[20];
char sex;
int age;
char score[20];
char location[20];
//struct student *next;
}stu[990];
int i;
for(i=0;;i++)
{
cin>>stu[i].stunum;
if(stu[i].stunum[0]=='e')
break;
cin>>stu[i].stuname>>stu[i].sex>>stu[i].age>>stu[i].score>>stu[i].location;
}
i--;
int n=i;
for(i=n;i>=0;i--)
{
cout<<stu[i].stunum<<' '<<stu[i].stuname<<' '<<stu[i].sex<<' '<<stu[i].age<<' '<<stu[i].score<<' '<<stu[i].location<<endl;
}
return 0;
}
|
31
|
15,277 |
main()
{
struct student
{
char num[20];
char name[20];
char sex;
int age;
float score;
char ad[20];
struct student *next;
};
struct student *head,*p1,*p2;
int 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->ad);//???????????
p1->next=NULL;
head=NULL;
while (n!=1)
{
p1=(struct student*)malloc(LEN);
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->ad);
p1->next=p2;
p2=p1;
}
else
n=1;
}
head=p2;
p1=head;
while (p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->ad);
p1=p1->next;
}
}
|
31
|
15,278 |
struct student
{char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct student *next;
struct student *front;
};
void main()
{
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
p1->front=NULL;
scanf("%s",&p1->number);
while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
{
scanf("%s %c%d%s%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
p1->front=p2;
scanf("%s",&p1->number);
}
p2->next=NULL;
while(p2!=NULL)
{
printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address);
p2=p2->front;
}
}
|
31
|
15,279 |
struct student
{
char info[50];
struct student *pre;
struct student *next;
};
void main()
{
int i=0,n=0;
struct student *p,*head,*p0;
p=head=(struct student *)malloc(sizeof(struct student));
while(strcmp((gets((*p).info)),"end")!=0)
{
n+=1;
p0=p;
p=(*p).next=(struct student *)malloc(sizeof(struct student));
(*p).pre=p0;
}
while(i++<n)
{
p=(*p).pre;
printf("%s\n",(*p).info);
}
}
|
31
|
15,280 |
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char address[50];
struct student *next;
};
void main()
{
struct student *head,*p,*s;
head=(struct student *)malloc(sizeof(struct student));
head->next=NULL;
p=head->next;
for(;;)
{
s=(struct student *)malloc(sizeof(struct student));
s->next=NULL;
scanf("%s",s->num);
if(strcmp(s->num,"end")==0)
break;
scanf("%s %c %d %s %s",s->name,&s->sex,&s->age,s->score,s->address);
head->next=s;
s->next=p;
p=s;
}
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,281 |
int n;
struct student
{
char s[100];
struct student *next;
};
void main()
{
struct student *head, *p1, *p2; n=0;
p1=p2=( struct student*) malloc(LEN);
gets(p1->s);
head=NULL;
while(p1->s[0]!='e')
{
n=n+1;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->s);
}
head=p2;
p1=head;
while(p1!=NULL)
{
printf("%s\n",p1->s);
p1=p1->next;
}
}
|
31
|
15,282 |
int n;
struct student
{
char str[100];
struct student *pre;
} *p1, *p2;
struct student *create(void)
{
struct student *last, *head;
p1 = p2 = (struct student *)malloc(sizeof(struct student)); //????
gets(p1->str);//?????
head=NULL;
n=0;
while (strcmp(p1->str,"end")!=0)
{
n=n+1; //??????
if (n==1)
{
head=p1;
p1->pre = NULL;//??????pre??
}
else
{
p1->pre = p2;//????pre????????
}
p2 = p1;//?????
p1 = (struct student *)malloc(sizeof(struct student));//????
gets(p1->str);
}
last=p1->pre=p2;
return (last);
}
void main ()
{
struct student *create();
struct student *last, *p;
last=create();
p=last;
do
{
printf("%s\n", p->str);
p=p->pre;
}
while (p->pre!=NULL);
if(p->pre==NULL)
printf("%s\n", p->str);
}
|
31
|
15,283 |
struct student
{
char NO[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
struct student *prev;
};
void main()
{
struct student *END;
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",&p1->NO,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
p1->prev=0;
p1=(struct student*)malloc(LEN);
for(;;)
{
scanf("%s",&p1->NO);
if(strcmp(p1->NO,"end")==0)
{
END=p2;
break;
}
scanf(" %s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
p1->prev=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
}
for(p1=END;p1!=0;)
{
printf("%s %s %c %d %s %s\n",p1->NO,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->prev;
}
}
|
31
|
15,284 |
struct link
{
char a[10][100];
struct link *next;
};
struct link *now,*past;
int i,n=1;
void build()
{
while (1)
{
now=(struct link*)malloc(sizeof(struct link));
scanf("%s",now->a[0]);
if (strcmp(now->a[0],"end")==0) return;
for (i=1;i<6;i++)
scanf("%s",now->a[i]);
if (n==1)
{
now->next=NULL;
} else now->next=past;
past=now;
n++;
}
}
void main()
{
build();
now=past;
while (now!=NULL)
{
printf("%s",now->a[0]);
for (i=1;i<6;i++)
printf(" %s",now->a[i]);
printf("\n");
now=now->next;
}
}
|
31
|
15,285 |
struct st
{
char id[10000];
struct st *next;
};
int main()
{
struct st *head=NULL,*p=NULL,*q=NULL;
char end;
while (1)
{
p=(struct st*)malloc(sizeof(struct st));
if(p!=NULL)
{
gets(p->id);
p->next=q;
if (p->id[0]=='e')
break;
else
q=p;
}
}
p=p->next;
while(1)
{
puts(p->id);
if (p->next==NULL)
break;
p=p->next;
}
}
|
31
|
15,286 |
struct student{
char xh[20];
char name[20];
char sex;
int age;
float score;
char dizhi[30];
struct student *next;
};
struct student *append(void)
{int n;
struct student *head,*newnode,*thisnode=NULL;
for (n=1;;n++)
{newnode=(struct student*)malloc(sizeof(struct student));
scanf("%s",&newnode->xh);
if (newnode->xh[0]=='e')
{head=thisnode;break;}
else
{scanf(" %s %c %d %f %s\n",&newnode->name,&newnode->sex,&newnode->age,&newnode->score,&newnode->dizhi);
newnode->next=thisnode;
thisnode=newnode;
}
}
return head;
}
void main()
{struct student *p;
for ( p=append();p!=NULL;p=p->next)
{printf("%s %s %c %d %g %s\n",p->xh,p->name,p->sex,p->age,p->score,p->dizhi);
}
}
|
31
|
15,287 |
struct student
{
char num[1000];
struct student *next;
};
int n;
struct student * creat (void )
{
struct student * head;
struct student *p1,*p2;
char a[4]={"end"};
n=0;
p1=p2= (struct student *)malloc(LEN);
gets( p1->num );
head = NULL;
while (strcmp(p1->num,a)!=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;
}
void print(struct student *head)
{
struct student *p;
p=head;
if (head !=NULL)
do
{
printf("%s\n",p->num );
p=p->next;
}
while (p!=NULL);
}
struct student * sort (struct student *head)
{
struct student *p1,*p2,*p3;
p1=head;
p2=p1->next;
p1->next=NULL;
while( p2->next!=NULL )
{
head=p2;
p3=p2->next;
p2->next=p1;
p1=p2;
p2=p3;
}
head=p2;
p2->next=p1;
return head;
}
void main()
{
struct student *head ;
head=creat();
head=sort(head);
print(head);
}
|
31
|
15,288 |
struct node
{
struct node *back;
char num[20];
char name[20];
char gender;
int age;
char score[10];
char address[20];
struct node *next;
};
void main()
{
char end[]="end";
char t[20];
struct node *p,*head;
p=(struct node *)malloc(sizeof(struct node));
head=p;
head->back=NULL;
scanf("%s %s %c %d %s %s",p->num,p->name,&p->gender,&p->age,p->score,p->address);
scanf("%s",t);
while(strcmp(t,end)!=0)
{
p->next=(struct node *)malloc(sizeof(struct node));
p->next->back=p;
p=p->next;
strcpy(p->num,t);
scanf("%s %c %d %s %s",p->name,&p->gender,&p->age,p->score,p->address);
scanf("%s",t);
}
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->gender,p->age,p->score,p->address);
p=p->back;
}while(p!=NULL);
}
|
31
|
15,289 |
struct s{
char xuehao[20];
char xingming[20];
char xingbie;
int age;
char score[20];
char add[20];
struct s *next;
};
int main(){
struct s *A(void);
struct s *head,*p;
head=A();
p=head;
if(head!=NULL){
while(p->next!=NULL){
printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->age,p->score,p->add);
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->age,p->score,p->add);
}
return 0;
}
struct s *A(void){
struct s *head,*p1,*p2;
head=(struct s*)malloc(sizeof(struct s));
scanf("%s %s %c %d %s %s",head->xuehao,head->xingming,&head->xingbie,&head->age,head->score,head->add);
head->next=NULL;
p1=head;
for(;;){
p2=(struct s*)malloc(sizeof(struct s));
scanf("%s",p2->xuehao);
if(strcmp(p2->xuehao,"end"))
scanf(" %s %c %d %s %s",p2->xingming,&p2->xingbie,&p2->age,p2->score,p2->add);
else
break;
p2->next=p1;
p1=p2;
}
p2->next=p1;
return (p1);
}
|
31
|
15,290 |
struct student
{char num[20];
char name[20];
char sex;
int age;
char score[20];
char addr[30];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *end,*p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",&p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
end=NULL;
while(strlen(p1->name)!=0)
{
n=n+1;
if(n==1)
{p1->next=NULL;}
else
{p1->next=p2;}
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",&p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
}
end=p2;
return end;
}
void main()
{
struct student *p,*end;
end=creat();
p=end;
if(end!=NULL)
{
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->next;
}
while(p!=NULL);
}
}
|
31
|
15,291 |
void main()
{
struct student
{
char str[100];
struct student *before;
struct student *next;
}*head,*p1,*p2;
p1=(struct student *)malloc(sizeof(struct student));
p1->before=NULL;
head=p1;
while(strcmp(p2->str,"end")!=0)
{
gets(p1->str);
p2=p1;
p1=(struct student*)malloc(sizeof(struct student));
p1->before=p2;
p2->next=p1;
}
p2->next=NULL;
p2=p2->before;
do
{
printf("%s\n",p2->str);
p2=p2->before;
}while(p2->before!=NULL);
printf("%s\n",p2->str);
}
|
31
|
15,292 |
struct student
{
char xuehao[20];
char name[50];
char sex;
int age;
float score;
char addr[100];
struct student *next;
};
void main()
{
struct student *p1,*p2,*head,*newhead,*p3;
int i=1;
long n=0;
p1=p2=(struct student *)malloc(LEN);
head=NULL;
scanf("%s %s %c %d%f %s",p1->xuehao,p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
while(i)
{
if(n==0)
{head=p2=p1;n++;}
else
{
p2->next=p1;p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->xuehao);
if(strcmp(p1->xuehao,"end")==0)
{i=0;p2->next=NULL;}
else {scanf("%s %c %d%f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);n++;}
}
}
for(i=0;i<n;i++)
{p2=p1=head;
while(p1->next!=NULL)
{p2=p1;
p1=p1->next;
}
if(i==0)
newhead=p3=p1;
else
p3=p3->next=p1;
p2->next=NULL;
}
p2=newhead;
for(i=0;i<n;i++)
{ printf("%s %s %c %d ",p2->xuehao,p2->name,p2->sex,p2->age);
if((*p2).score==(int)(p2->score))
printf("%d ",(int)p2->score);
else printf("%.1f ",p2->score);
printf("%s\n",p2->addr);
p2=p2->next;
}
}
|
31
|
15,293 |
struct node
{
char no[20],name[20],sex,ad[20],score[20];
int age;
struct node *next;
}*start=NULL,*p;
int main()
{
struct node * temp;
while(1==1)
{
temp=(struct node *)malloc(sizeof(struct node));
scanf("%s",temp->no);
if(strcmp(temp->no,"end")==0) break;
scanf(" %s %c %d %s %s",temp->name,&temp->sex,&temp->age,temp->score,temp->ad);
temp->next=start;
start=temp;
}
p=start;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->no,p->name,p->sex,p->age,p->score,p->ad);
p=p->next;
}
printf("\n");
return 0;
}
|
31
|
15,294 |
struct stu
{
char xuehao[20];
char name[20];
char sex[10];
int old;
float score;
char where[20];
struct stu *next;
};
void main()
{
struct stu *head,*p0,*p;
int i;
char a[4]="end\0";
head=NULL;
for(i=0;;i++)
{
p0=(struct stu*)malloc(LEN);
scanf("%s",p0->xuehao);
if(strcmp(p0->xuehao,a)==0)
break;
scanf("%s%s%d%f%s",p0->name,p0->sex,&p0->old,&p0->score,p0->where);
if(head==NULL)
{
head=p0;
p0->next=NULL;
p=p0;
}
else
{
head=p0;
p0->next=p;
p=p0;
}
}
for(p=head;p!=NULL;p=p->next)
{
printf("%s %s %s %d %g %s\n",p->xuehao,p->name,p->sex,p->old,p->score,p->where);
}
}
|
31
|
15,295 |
struct student
{
char num[50]; /*??*/
char name[50];/*??*/
char sex;/*??*/
int year;/*??*/
char score[50]; /*??*/
char add[50];/*??*/
struct student *next; /*?????????*/
};
int n; /*????*/
struct student *Create()
{
struct student *head; /*???*/
struct student *p1=NULL; /*p1???????????*/
struct student *p2=NULL; /*p2??????????????*/
n = 0; /*???????????0????*/
p1 = (struct student *)malloc(LEN); /*???????*/
p2 = p1; /*??????????p2??????????????*/
if (p1 == NULL) /*???????*/
{
printf("\nCann't create it, try it again in a moment!\n");
return NULL;
}
else /*??????*/
{
head = NULL; /*??head??NULL*/
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->year,p1->score,p1->add);
/*????*/
}
int j=0;
for(;;j++)
{
n += 1; /*??????1?*/
if (n==1) /*???????1????????head*/
{
p1->next = NULL;
head=p2;
}
else
{
p1->next = p2; /*???????????????*/
}
p2 = p1; /*?p1????p2?????p1??????*/
p1 = (struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{
head=p2;
break;/*???????????*/
}
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add);
}
head=p2; /*????????????head*/
free(p1); /*??p1*/
p1 = NULL; /*????????????????NULL,?????"???"???????????*/
return head; /*??????????*/
}
void Print(struct student *head)
{
struct student *p;
p = head;
if(head != NULL) /*??????????????????*/
{
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add);
p = p->next; /*???????*/
}
while (p != NULL);
}
}
int main()
{
struct student *head;
head = Create();
Print(head);
return 0;
}
|
31
|
15,296 |
struct student //??????
{
char num[10]; //??
char name[20]; //??
char sex[5]; //??
int age; //??
char score[20]; //??
char addr[20]; //??
struct student *next;
};
struct student *head; //???????
struct student *input() //??????
{
struct student *p1,*p2;
p1=p2=(struct student *)malloc(sizeof(struct student)); //????????????
scanf("%s",p1->num); //????
p2->next=NULL; //??p2????
while(strcmp(p1->num,"end")!=0) //???????end??????????
{
scanf("%s",p1->name); //????
scanf("%s",p1->sex); //????
scanf("%d",&p1->age); //????
scanf("%s",p1->score); //????
scanf("%s",p1->addr); //????
p1=(struct student *)malloc(sizeof(struct student)); //??????????
scanf("%s",p1->num); //????
p1->next=p2; //p2????p1????????
p2=p1; //?p1?????p2
}
head=p1; //?????p1
return(head); //??
}
void print(struct student *head) //??????
{
struct student *p; //??????????????
p=head->next; //p?????????????
if(head!=NULL) //????????????
do
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->next;
}
while(p!=NULL); //?p?????????????????????
}
main() //?????
{
input(); //??????
print(head); //??????
struct student *p1,*p2; //????????
p1=p2=head->next; //?p1?p2??????????
if(head!=NULL) //???????NULL???
do
{
p1=p2->next; //?p2?????????p1
free(p2); //??p2???
p2=p1; //?p1????p2
}
while(p2!=NULL); //?p2??NULL???
return 0; //??;
}
|
31
|
15,297 |
int main()
{
struct student
{
char imfor[100];
};
int n=1,m;
struct student *p1,*p3[600];
p1=p3[0]=(struct student *)malloc(sizeof(struct student));
gets(p1->imfor);
while (p1->imfor[0]!='e')
{
p1=(struct student * )malloc(sizeof(struct student));
p3[n]=p1;
n++;
gets(p1->imfor);
}
for (m=n-2;m>=0;m--)
{
printf("%s\n",p3[m]->imfor);
}
}
|
31
|
15,298 |
int main()
{
int i;
struct student
{
char num[100];
char name[100];
char sex;
int age;
char score[100];
char address[100];
struct student *next;
}a[10000],*head,*p;
int n;
for(i=0;i<10000;i++)
{
scanf("%s",a[i].num);
if(a[i].num[0]=='e')
{break;}
scanf("%s %c %d %s %s",a[i].name,&a[i].sex,&a[i].age,a[i].score,a[i].address);
}
i=i-1;
head=&a[i];
for(n=i;n>0;n--)
{
a[n].next=&a[n-1];
}
a[0].next=NULL;
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,299 |
struct student
{
char num[100];
char nam[100];
char sex[2];
char age[100];
char sco[100];
char add[100];
struct student *prev;
struct student *next;
};
struct student *create(void)
{
struct student *head,*end,*p1,*p2;
int n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
n++;
scanf("%s%s%s%s%s",p1->nam,p1->sex,p1->age,p1->sco,p1->add);
if(n==1)
{
head=p1;
p1->prev=NULL;
}
else
{
p2->next=p1;
p1->prev=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 %s %s %s %s\n",p->num,p->nam,p->sex,p->age,p->sco,p->add);
p=p->prev;
}while(p!=NULL);
}
void main()
{
struct student *end;
end=create();
print(end);
}
|
31
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.