label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
|---|---|---|
31
|
15200
|
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
|
15201
|
void append()
{
char str[50];
gets(str);
if (str[0] != 'e')
{
append();
puts(str);
}
}
void main()
{
append();
}
|
31
|
15202
|
struct w
{char id[100];
struct w *next;
};
struct w *head,*new,*newhead,*p1,*p2;
int i,n;
void main()
{
n=0;
head=null;
p1=p2=(struct w *)malloc(len);
gets(p1->id);
while(strcmp(p1->id,"end")!=0)
{
n++;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct w *)malloc(len);
gets(p1->id);
}
p2->next=null;
for(i=0;i<n;i++)
{p2=p1=head;
while(p1->next!=null)
{p2=p1;p1=p1->next;}
if(i==0) newhead=new=p1;
else new=new->next=p1;
p2->next=null;
}
p1=newhead;
for(i=0;i<n;i++)
{printf("%s\n",p1->id);
p1=p1->next;
}
}
|
31
|
15203
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
float score;
char add[20];
struct student * next;
};
struct student * input(void)
{
struct student *p1,*p2,*head;
p1=(struct student *)malloc(len);
p1->next=NULL;
scanf("%s %s %c %d %f %s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
do
{
p2=(struct student *)malloc(len);
scanf("%s %s %c %d %f %s",p2->num,p2->name,&p2->sex,&p2->age,&p2->score,p2->add);
p2->next=p1;
p1=p2;
}while(strcmp(p2->num,"end")!=0);
head=p2->next;
return(head);
}
void print(struct student*head)
{
struct student *p;
p=head;
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
} while(p!=NULL);
}
void main()
{
struct student * head;
head=input();
print(head);
}
|
31
|
15204
|
struct shuju
{
char str[100];
struct shuju * next;
};
struct shuju *create()
{
struct shuju *head,*p1,*p2;
p1=(struct shuju* )malloc(len);
gets(p1->str);
p1->next=NULL;
while (1)
{
p2=p1;
p1=(struct shuju* )malloc(len);
gets(p1->str);
if(strcmp(p1->str,"end")==0) {free(p1);break;}
p1->next=p2;
}
head=p2;
return (head);
}
void print(struct shuju* head)
{
struct shuju* p;
p=head;
while (p->next!=NULL)
{
puts(p->str);
p=p->next;}
puts(p->str);
}
void main()
{
struct shuju *p;
p=create();
print(p);
}
|
31
|
15205
|
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
|
15206
|
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
|
15207
|
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
|
15208
|
struct stu
{
char xinxi[100];
struct stu *down;
};
int n=0;
struct stu * creat()
{
struct stu *top=NULL;
struct stu *p1=NULL,*p2=NULL;
p1=p2=(struct stu *)malloc(LEN);
gets(p1->xinxi);
while(p1->xinxi[0]!='e')
{
n++;
if(n==1)
p1->down=NULL;
else
p1->down=p2;
top=p1;
p2=p1;
p1=(struct stu *)malloc(LEN);
gets(p1->xinxi);
}
return(top);
}
void main()
{
struct stu *top,*p;
top=creat();
p=top;
while(n!=0)
{n--;
puts(p->xinxi);
p=p->down;
}
}
|
31
|
15209
|
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
|
15210
|
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
|
15211
|
struct stu
{char c[100];
struct stu *previous;
};
int n;
struct stu *creat(void)
{
struct stu *p,*q;
n=0;
p=q=(struct stu *)malloc(Len);
gets(p->c);
for(;strcmp(p->c,"end")!=0;)
{
n++;
if(n==1) p->previous=Null;
else
{
p=(struct stu *)malloc(Len);
p->previous=q;
q=p;
gets(p->c);
}
}
return(p);
}
void main()
{
struct stu *p;
p=creat();
p=p->previous;
for(;p!=Null;)
{
printf("%s\n",p->c);
p=p->previous ;
}
}
|
31
|
15212
|
struct Info
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char address[20];
struct Info* next;
struct Info* former;
};
int main()
{
struct Info *head,*p1,*p2,*p,*tail;
head=(struct Info*)malloc(sizeof(struct Info));
p1=head;
p2=head;
char temp[10];
scanf("%s %s %c %d %s %s",p2->num,p2->name,&p2->sex,&p2->age,p2->score,p2->address);
head->former=NULL;
head->next=NULL;
p2=(struct Info*)malloc(sizeof(struct Info));
while(1)
{
scanf("%s",temp);
if (strcmp(temp,"end")!=0)
{
strcpy(p2->num,temp);
scanf("%s %c %d %s %s",p2->name,&p2->sex,&p2->age,p2->score,p2->address);
p2->former=p1;
p2->next=NULL;
p1->next=p2;
p1=p2;
p2=(struct Info*)malloc(sizeof(struct Info));
}
else
{
tail=p1;
break;
}
}
p=tail;
do
{
if((p->score-(int)p->score)!=0)
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
else
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->former;
}
while(p!=NULL);
return 0;}
|
31
|
15213
|
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
|
15214
|
struct stu_imformation
{
char num[16];
char name[20];
char sex;
int age;
char score[10];
char site[20];
struct stu_imformation *next;
};
void main()
{
struct stu_imformation *head,*p1,*p2;
head=(struct stu_imformation *)malloc(LEN);
scanf("%s %s %c %d %s %s",head->num,head->name,&head->sex,&head->age,head->score,head->site);
p2=head;
head->next=NULL;
p1=(struct stu_imformation *)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end"))
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->site);
p1->next=p2;
head=p1;
p2=p1;
p1=(struct stu_imformation *)malloc(LEN);
scanf("%s",p1->num);
}
p1=head;
while(p1!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->site);
p1=p1->next;
}
}
|
31
|
15215
|
struct student
{
char num[15];
char name[20];
char sex;
int age;
char score[10];
char add[30];
struct student *next;
};
int main()
{
int n,i;
struct student *head,*p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
p1->next=NULL;
scanf("%s ",p1->num);
while(strcmp(p1->num,"end")!=0)
{
n++;
scanf("%s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
p2=(struct student *)malloc(LEN);
p2->next=p1;
p1=p2;
scanf("%s ",p1->num);
}
head=p1->next;
p1=p2=head;
for(i=0;i<n;i++)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p2->next;
p2=p1;
}
}
|
31
|
15216
|
struct student
{
char stuID[20];
char name[20];
char sex;
int age;
char score[10];
char add[20];
struct student*next;
};
int main()
{
struct student *p,*a;
char str[10]={"end"};
p=(struct student*)malloc(sizeof(struct student));
scanf("%s",p->stuID);
p->next=NULL;
while(strcmp(p->stuID,str)!=0)
{
scanf("%s %c %d %s %s",p->name,&(p->sex),&(p->age),p->score,p->add);
a=p;
p=(struct student*)malloc(sizeof(struct student));
p->next=a;
scanf("%s",p->stuID);
}
while(p->next!=NULL)
{
p=p->next;
printf("%s %s %c %d %s %s\n",p->stuID,p->name,p->sex,p->age,p->score,p->add);
}
return 0;
}
|
31
|
15217
|
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
|
15218
|
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
|
15219
|
struct student
{
char str[1000];
struct student *next;
};
int main()
{
struct student *p,*pnew,*head,*p1;
pnew=(struct student *)malloc(sizeof(struct student));
gets(pnew->str);
pnew->next=NULL;
if(strcmp(pnew->str,"end")==0)
{
free(pnew);
head=NULL;
}
else
{
head=pnew;
p=pnew;
while(1)
{
pnew=(struct student *)malloc(sizeof(struct student));
gets(pnew->str);
pnew->next=NULL;
if(strcmp(pnew->str,"end")==0)
{
free(pnew);
break;
}
else
{
head=pnew;
pnew->next=p;
p=pnew;
}
}
}
p1=head;
while(p1)
{
printf("%s\n",p1->str);
p1=p1->next;
}
return 0;
}
|
31
|
15220
|
struct student//?? ?? ?? ?? ?? ??
{
char num[12];
char name[20];
char sex;
int age;
float grade;
char add[12];
struct student *next;
};
int n=1;
struct student *build(void) //????
{
struct student *pn, *pt;
pn=(struct student*)malloc(sizeof(struct student));
scanf("%s",pn->num);
pn->next=NULL;
while(pn->num[0]!='e')
{
scanf(" %s %c %d %f %s",&pn->name,&pn->sex,&pn->age,&pn->grade,&pn->add);
pt=pn;
pn=(struct student*)malloc(sizeof(struct student));
pn->next=pt;
scanf("%s",pn->num);
}
return (pt);
}
void main()
{
struct student *p;
p=build();
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add);
p=p->next;
}
}
|
31
|
15221
|
struct student{char xh[20];char name[50];char sex;int age;char gra[10];char adds[50];struct student *next;};
void main()
{
struct student *pa,*pb;
int i;
pa=pb=(struct student*)malloc(l);
for(i=0; ;i++)
{ scanf("%s",pa->xh);
if(pa->xh[0]=='e') break;
scanf("%s %c %d %s %s",pa->name,&pa->sex,&pa->age,pa->gra,pa->adds);
if(i==0) {pa->next=NULL;}
else pa->next=pb;
pb=pa;
pa=(struct student*)malloc(l);
}
while(pb!=NULL) {printf("%s %s %c %d %s %s\n",pb->xh,pb->name,pb->sex,pb->age,pb->gra,pb->adds);pb=pb->next;}
}
|
31
|
15222
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char add[20];
struct student *next;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=p2=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
head=p1;
loop:
p1=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
if(strcmp(p1->num,"end")!=0)
{
p2->next=p1;
p2=p1;
goto loop;
}
else p2->next=NULL;
return(head);
}
struct student *reverse(struct student *head)
{
struct student *nowp,*prep,*nextp;
prep=NULL;
nowp=head;
while(nowp!=NULL)
{
nextp=nowp->next;
nowp->next=prep;
prep=nowp;
nowp=nextp;
}
return(prep);
}
int main()
{
struct student *head,*head1;
head=creat();
head1=reverse(head);
struct student *pt1;
pt1=head1;
while(pt1!=NULL)
{
printf("%s %s %c %d %s %s\n",pt1->num,pt1->name,pt1->sex,pt1->age,pt1->score,pt1->add);
pt1=pt1->next;
}
return 0;
}
|
31
|
15223
|
struct stu
{ char num[20];
char name[30];
char sex;
int age;
float score;
char add[30];
struct stu *next;
};
void main()
{ int i,len=1;
struct stu *p1,*p2,*head,*new,*newhead;
p1=p2=head=(struct stu*)malloc(sizeof(struct stu));
printf("\n");
scanf("%s %s %c %d %f %s" ,p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
while(strcmp(p1->num,"end")!=0)
{p1=(struct stu*)malloc(sizeof(struct stu));
scanf("%s %s %c %d %f %s" ,p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
printf("\n");
if(strcmp(p1->num,"end")==0)
p2->next=NULL;
else
{p2->next=p1;
p2=p1;
len++;}
}
p1=head;
for(i=0;i<len;i++)
{ p1=p2=head;
while(p1->next!=NULL)
{p2=p1;
p1=p1->next;
}
if(i==0)
newhead=new=p1;
else
new=new->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<len;i++)
{printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
}
|
31
|
15224
|
struct student
{
char a[100];
struct student *next;
};
struct student *create()
{
struct student *p1,*p2;
p1=(struct student*)malloc(len);
gets(p1->a);
p1->next=NULL;
p2=p1;
for(;;)
{
p1=(struct student*)malloc(len);
gets(p1->a);
if(strcmp(p1->a,"end")==0)
{
free(p1);
break;
}
p1->next=p2;
p2=p1;
}
return p2;
}
void main()
{
struct student *head,*p1;
struct student *create();
head=create();
p1=head;
while(p1)
{
printf("%s\n",p1->a);
p1=p1->next;
}
}
|
31
|
15225
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
char score[20];
char address[20];
struct student*next;
};
char t[4]={"end"};
struct student*p1,*p2;
struct student * creat(void) //???????
{
struct student*head;
int n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s", p1->num);
while ( strcmp(p1->num,t)!=0)
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
n=n+1;
if(n==1)
{
head = p1;
}
else
{
p2->next=p1;
}
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
}
p2->next = NULL;
return(head);
}
struct student*order(struct student*head) //???????
{
struct student*ben,*rehead=NULL;
while(head->next!=NULL)
{
p2=NULL;
p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(rehead==NULL)
{
rehead=p1;
ben=rehead->next=p2;
}
ben=ben->next=p2;
p2->next=NULL;
};
return(rehead);
}
void print(struct student*head) //???????
{
struct student*p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}while(p!=NULL);
}
int main()
{
struct student*head;
head=creat();
head=order(head);
print(head);
return 0;
}
|
31
|
15226
|
struct stu
{char num[50];
char name[50];
char sex[1];
int age;
char score[50];
char add[50];
struct stu *next;
};
int main()
{struct stu *head,*p1,*p2;
p1=(struct stu*)malloc(LN);
scanf("%s",p1->num);
scanf("%s",p1->name);
scanf("%s",p1->sex);
scanf("%d",&p1->age);
scanf("%s",p1->score);
scanf("%s", p1->add);
p1->next=NULL;
p2=p1;head=p1;
do
{ p1=(struct stu*)malloc(LN);
scanf("%s",p1->num);
if(*(p1->num)=='e')
{free(p1);head=p2;break;}
else
{
scanf("%s",p1->name);
scanf("%s",p1->sex);
scanf("%d",&p1->age);
scanf("%s",p1->score);
scanf("%s", p1->add);
p1->next=p2;
p2=p1;
}
}while(1);
while(head)
{printf("%s %s %c %d %s %s\n",head->num,head->name,*(head->sex),head->age,head->score,head->add);
head=head->next;
}
}
|
31
|
15227
|
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
|
15228
|
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
|
15229
|
struct student
{
char temp[50];
struct student *previous;
};
void main()
{
struct student *end,*head;
struct student *p1,*p2, *p;
/*p1=(struct student *)malloc(LEN);*/
p2=head=NULL;
while(1)
{
p1=(struct student*)malloc(LEN);
gets(p1->temp);
if (strcmp(p1->temp,"end")==0)
{
/*delete p1;*/
break;
}
if(head==NULL) {
head=p1;
head->previous=NULL;
}
else
p1->previous=p2;
p2=p1;
}
/*p1->previous=p2;*/
p=p2;
if(p!=NULL)
while(p) {
puts(p->temp);
p=p->previous;
}
}
|
31
|
15230
|
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
|
15231
|
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
|
15232
|
struct student{
struct student * formal;
char xuehao[20];
char xingming[20];
char xingbie;
int nianling;
char defen[20];
char dizhi[30];
struct student * next;
};
int n=0;
struct student * creat(void);
void print(struct student *end);
void main()
{
struct student * enda;
enda=creat();
print(enda);
return 0;
}
struct student * creat(void)
{
struct student * end;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s",p1->xuehao);
while(p1->xuehao[0]!='e')
{
scanf("%s %c %d%s%s",p1->xingming,&p1->xingbie,&p1->nianling,p1->defen,p1->dizhi);
n=n+1;
if(n==1)
{
p1->formal=NULL;
}
else
{
p2->next=p1;
p1->formal=p2;
}
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->xuehao);
}
p2->next=NULL;
end=p2;
return(end);
}
void print(struct student *end)
{
struct student *p;
p=end;
if(end!=NULL)
{
do
{
printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->defen,p->dizhi);
p=p->formal;
}while(p!=NULL);
}
}
|
31
|
15233
|
// 1209.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
struct data
{
char num[200],name[200],sex,add[200];
int age;
char score[200];
struct data *next;
};
struct data *creat()
{
struct data *head,*p1 = NULL,*p2 = NULL;
int n=0;
do{
p2=p1;
p1=(struct data*)malloc(sizeof(struct data));
scanf("%s",p1->num);
if(*p1->num=='e')
{
head=p2;
free(p1);
break;
}
scanf("%s %c %d %s %s\n",p1->name,&(p1->sex),&(p1->age),p1->score,p1->add);
if(n==0) p1->next=NULL;
if(n!=0) p1->next=p2;
n=1;
}
while(1);
return head;
}
void print(struct data *head)
{
struct data *p;
p=head;
while(p)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}
}
int main()
{
struct data *head;
head=creat();
print(head);
return 0;
}
|
31
|
15234
|
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
|
15235
|
int main()
{
int i,m;
char a[501][500];
for(i=0;;i++)
{
gets(a[i]);
if (a[i][0]=='e')
{
m=i;
break;
}
}
for(i=m-1;i>=0;i--)
{
puts(a[i]);
}
return 0;
}
|
31
|
15236
|
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
|
15237
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[20];
char address[50];
struct student *next;
};
void main()
{
struct student *head,*p,*q,*t;
t=(struct student*)malloc(sizeof(struct student));
t->next=NULL;
head=(struct student*)malloc(sizeof(struct student));
head->next=NULL;
int i;
for(i=0;;i++)
{
p=head->next;
q=(struct student*)malloc(sizeof(struct student));
q->next=NULL;
scanf("%s",q->num);
if(q->num[0]=='e')
break;
scanf("%s %c %d %s %s",q->name,&q->sex,&q->age,q->score,q->address);
t->next=p;
head->next=q;
q->next=p;
}
head->next=p;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
}
|
31
|
15238
|
struct stu
{
char zifu[200];
struct stu *next;
};
struct stu stu[1000];
void main()
{ int i;
struct stu *p=stu;
for(i=0;i<1000;i++,p++)
{
gets(p->zifu);
char str[10]="end";
if((strcmp(p->zifu,str))==0)
break;
p->next=(p-1);
}
p=p-1;
stu[0].next=NULL;
while(p!=NULL)
{
puts(p->zifu);
p=p->next;
}
}
|
31
|
15239
|
struct student
{
char num[10];
char name[20];
char sex[2];
int age;
char score[30];
char add[30];
struct student *next;
};
int main()
{ struct student *head;
struct student *p1,*p2,*p;
p2=p=(struct student*)malloc(sizeof(struct student));
scanf("%s%s%s%d%s%s",p2->num,p2->name,p2->sex,&p2->age,p2->score,p2->add);
p2->next=NULL;
do
{
p2=(struct student*)malloc(sizeof(struct student));
scanf("%s",p2->num);
if(strcmp(p2->num,"end")==0)
break;
scanf("%s%s%d%s%s",p2->name,p2->sex,&p2->age,&p2->score,p2->add);
p2->next=p;
p=p2;
}
while(strcmp(p2->num,"end")!=0);
head=p;
for(p1=head;p1!=NULL;p1=p1->next)
{
printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}
return 0;
}
|
31
|
15240
|
struct stu
{
char num[21];
char name[21];
char sex;
int age;
char score[11];
char addr[21];
struct stu *pre,*next;
}head,end;
void create()
{
struct stu *p1,*p2;
p2=&head;
p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s",p1->num);
while (strcmp(p1->num,"end")!=0)
{
p2->next=p1;
p1->pre=p2;
scanf("%s",p1->name);
scanf(" %c",&p1->sex);
scanf("%d",&p1->age);
scanf("%s",p1->score);
scanf("%s",p1->addr);
p2=p1;
p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s",p1->num);
}
p2->next=&end;
end.pre=p2;
}
void anti_print()
{
struct stu *p;
int flag=0;
p=end.pre;
while (p!=&head)
{
if (flag) printf("\n");
printf("%s",p->num);
printf(" %s",p->name);
printf(" %c",p->sex);
printf(" %d",p->age);
printf(" %s",p->score);
printf(" %s",p->addr);
p=p->pre;
flag=1;
}
}
void main()
{
head.pre=NULL;
end.next=NULL;
create();
anti_print();
}
|
31
|
15241
|
//???????
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
|
15242
|
struct student
{
char number[15];
char name[20];
char gender[3];
int age;
float score;
char address[30];
struct student *next;
};
struct student *creat(void)
{
int i=1;
struct student *head,*p1=(struct student *)malloc(LEN);
head=p1;
head->next=NULL;
scanf("%s%s%s%d%f%s",p1->number,p1->name,p1->gender,&p1->age,&p1->score,p1->address);
while(1)
{
p1=(struct student *)malloc(LEN);
scanf("%s",p1->number);
if((i=strcmp(p1->number,"end"))==0)break;
scanf("%s%s%d%f%s",p1->name,p1->gender,&p1->age,&p1->score,p1->address);
p1->next=head;
head=p1;
}
return(head);
}
void print(struct student *p)
{
do{printf("%s %s %s %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);p=p->next;}while(p->next!=NULL);
printf("%s %s %s %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
}
void main()
{
struct student *p=creat();
print(p);
}
|
31
|
15243
|
void main()
{
char s[1024][128];
int i=0;
while(gets(s[i]))
{
if(strcmp(s[i],"end")==0) break;
i++;
}
while(i!=0)
{
i--;
puts(s[i]);
}
}
|
31
|
15244
|
struct student{
char num[20];
char name[20];
char sex;
int age;
float score;
char address[20];
struct student *next;
};
int n;
struct student *create()
{
struct student *head;
struct student *p1,*p2;
head=NULL;
n=0;
p1=p2=(struct student *)malloc(len);
scanf("%s",p1->num);
if(p1->num[0]=='e')
return(head);
scanf("%s %c %d%f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
//printf("%s %s %c %d%d %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
while(n!=-1)
{
n++;
if(n==1)
p1->next=NULL;
else
p1->next=p2;
p2=p1;
p1=(struct student *)malloc(len);
scanf("%s",p1->num);
if(p1->num[0]=='e')
break;
scanf("%s %c %d%f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
//printf("%s %s %c %d%d %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
}
head=p2;
return(head);
}
void print(struct student *p)
{
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
}
void main()
{
struct student *p;
p=create();
print(p);
}
|
31
|
15245
|
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
|
15246
|
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
|
15247
|
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
|
15248
|
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
|
15249
|
struct stu
{
char xuehao[100];
struct stu*next;
};
void main()
{
int n=0;
struct stu *head=NULL,*p1=NULL,*p2=NULL;
p1=p2=(struct stu*)malloc(LEN);
gets(p1->xuehao);
while(strcmp(p1->xuehao,"end")!=0)
{
n++;
if(n==1)
{
p1->next=NULL;
}
else
p1->next=p2;
p2=p1;
p1=(struct stu*)malloc(LEN);
gets(p1->xuehao);
}
while(p2->next!=NULL)
{
printf("%s\n",p2->xuehao);
p2=p2->next;
}
printf("%s\n",p2->xuehao);
}
|
31
|
15250
|
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
|
15251
|
struct student
{
struct student *next;
char a[100];
};
int n;
struct student *creat()
{
struct student *p1,*p2,*head;
n=0;
p1=(struct student *)malloc(sizeof(struct student ));
gets(p1->a);
p2=p1;
head=NULL;
while (strcmp(p1->a,"end")!=0)
{
n=n+1;
if(n==1)
head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student ));
gets(p1->a);
}
p2->next=NULL;
return(head);
}
/*void main()
{
struct student *p,*head;
head=creat();
p=head;
while(p!=NULL)
{
printf("%s\n",p->a);
p=p->next;
}
}*/
void main()
{
struct student *p1,*head,*p2;
head=creat();
p1=head;
while(1)
{
if(p1->next!=NULL) {p2=p1;p1=p1->next;}
if(p1->next==NULL&&p2!=head)
{
printf("%s\n",p1->a);
p2->next=NULL;
p1=head;
}
if(p1->next==NULL&&p2==head) break;
}
printf("%s\n%s",p1->a,head->a);
}
|
31
|
15252
|
struct student
{
char num[30];
char name[20];
char a[3];
int age;
char score[10];
char add[30];
struct student *next;
};
int n;
void *malloc(unsigned int size);
void main()
{
int l=0,i=0;
struct student *head,*p1,*p2,*newhead,*new1;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s%s%s%d%s%s",&p1->num,&p1->name,&p1->a,&p1->age,&p1->score,&p1->add);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s%s%s%d%s%s",&p1->num,&p1->name,&p1->a,&p1->age,&p1->score,&p1->add);
}
p2->next=NULL;
for(i=0;i<n;i++)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(i==0)
newhead=new1=p1;
else new1=new1->next=p1;
p2->next=NULL;
}
p1=newhead;
for(l=0;l<n;l++)
{
printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->a,p1->age,p1->score,p1->add);
p1=p1->next;
}
}
|
31
|
15253
|
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
|
15254
|
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
|
15255
|
struct stu
{char num[20];
char name[20];
char sex;
int age;
char score[10];
char add[20];
struct stu *next;};
void main()
{
struct stu *p1,*p2;
int n=0;
p1=p2=(struct stu*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0) {n=-1;p2=NULL;}
else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
while(n>=0)
{n+=1;
if(n==1)p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct stu*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)break;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);}
while(p2!=NULL)
{printf(A,p2->num,p2->name,p2->sex,p2->age,p2->score,p2->add);
p2=p2->next;}
}
|
31
|
15256
|
/*°ü?0?8¨?0?6?0?0?0?0?0?7?0?4?0?4?0?5?0?1?0?1?0?7?0?6?0?3?0?4?0?4?0?9?0?4?0?8?0?5?0?6?0?3?0?0?0?2?0?5§?0?7ú?0?8?0?2?0?4?0?3?0?3?0?4?0?5?0?1?0?6?0?4?0?5?0?2
00630018 zhouyan m 20 10.0 28#460
?0?8?0?1?0?6?0?5?0?8?0?2×?0?6?0?2ó?0?6?0?8"end"?0?5á?0?8?0?3
?0?1?0?1?0?7?0?3?0?8?0?1?0?6?0?2
?0?5?0?0?0?8?0?1?0?6?0?5?0?8?0?2?0?2?0?3?0?6?0?6°?0?7?0?9?0?9
?0?5§?0?2?0?3 ?0?4?0?9?0?1?0?4 ?0?4?0?8±?0?8 ?0?2ê?0?9?0?1 ?0?8?0?1·?0?0 ?0?8?0?1?0?0·
?0?8?0?2?0?0?0?9?0?8?0?5?0?8?0?1?0?4ò?0?8?0?1?0?6?0?2 */
struct student
{
char info[100];
struct student *pre;
};
struct student *creat()
{
struct student *head,*p1,*p2;
head=(struct student *)malloc(sizeof(struct student));
p1=head;
head->pre=0;
while(1)
{
gets(p1->info);
if(p1->info[0]=='e')
{
return p1->pre;
}
else
{
p2=(struct student *)malloc(sizeof(struct student));
p2->pre=p1;
p1=p2;
}
}
}
int main()
{
struct student *p;
p=creat();
while(p!=0)
{
printf("%s\n",p->info);
p=p->pre;
}
return 0;
}
/*00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
end
10630018 zouan m 20 10 28#46000
0630018 zuyan m 21 100 28#4600
01030018 houyan m 20 10 28#4600
00160018 zouyan f 21 100 28#4600
00613018 zhuyan m 20 100 28#4600
0063018 zhouan m 21 10000 28#4600000
0063008 zhoyan f 20 1000 28#460000
0063001 zhouyn f 21 100 28#460000
Press any key to continue*/
|
31
|
15257
|
struct student{
char num[20];
char name[30];
char sex;
int age;
float score;
char adress[30];
struct student *next;
struct student *last;
};
int n=1;
struct student *ANewNode(void)
{
struct student *head=NULL,*newnode,*thisnode;
do
{
newnode=(struct student *)malloc(sizeof(struct student));
scanf("%s",newnode->num);
if(strcmp(newnode->num,"end")==0)
{
thisnode->next=NULL;
head=thisnode;
break;
}
else;
scanf("%s %c %d %f %s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->adress);
if(n==1)
{
head=newnode;
thisnode=head;
thisnode->last=NULL;
}
else
{
thisnode->next=newnode;
newnode->last=thisnode;
}
thisnode=newnode;
n=n+1;
}while(strcmp(newnode->num,"enff")!=0);
return(head);
}
int main()
{
struct student *head,*p;
head=ANewNode();
p=head;
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->adress);
p=p->last;
}while(p!=NULL);
scanf("%d",&n);
return 0;
}
|
31
|
15258
|
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
|
15259
|
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
|
15260
|
struct aa
{
char data[100];
struct aa* next;
};
void print(struct aa* p)
{
if (p->next!=NULL) print(p->next);
cout <<p->data<<endl;
}
int main()
{
struct aa *head,*p,*q;
int si=sizeof(struct aa);
head=(struct aa*)malloc(si);
p=head;q=head;
char s[100];
while (cin.getline(s,100))
if (strcmp(s,"end"))
{
q=(struct aa*)malloc(si);
p->next=q;
strcpy(q->data,s);
q->next=NULL;
p=q;
}
else break;
print(head->next);
return 0;
}
|
31
|
15261
|
struct student
{
char stu[100];
}a[10000];
void main()
{
int i,j;
for(i=0;;i++)
{
gets(a[i].stu);
if(a[i].stu[0]=='e')
{
a[i].stu[0]='\0';
break;
}
}
for(j=i;j>=0;j--)
{
puts(a[j].stu);
}
}
|
31
|
15262
|
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
|
15263
|
struct stu
{
char ss[10000];
struct stu *next;
};
int main()
{
long int i,j,k,l,m,n;
struct stu *p,*p1;
p1=p=(struct stu*)malloc(len);
p1=null;
while (1)
{
p=(struct stu*)malloc(len);
gets(p->ss);
p->next=p1;
p1=p;
if (strcmp(p->ss,"end\0")==0) break;
}
p=p->next;
while (p!=null)
{
puts(p->ss);
p=p->next;
}
scanf("%d",&i);
}
|
31
|
15264
|
struct student
{
char xuehao[100];
char name[100];
char s;
int age;
float score;
char add[100];
};
int main()
{
int i,j,n=0;
struct student stu[1000];
for(i=0;i<1000;i++)
{
scanf("%s",stu[i].xuehao);
if(stu[i].xuehao[0]=='e'&&stu[i].xuehao[1]=='n'&&stu[i].xuehao[2]=='d') break;
scanf("%s %c %d %f %s",stu[i].name,&stu[i].s,&stu[i].age,&stu[i].score,stu[i].add);
n++;
}
for(j=n-1;j>=0;j--)
{
if((int)stu[j].score==stu[j].score)
printf("%s %s %c %d %d %s\n",stu[j].xuehao,stu[j].name,stu[j].s,stu[j].age,(int)stu[j].score,stu[j].add);
else
printf("%s %s %c %d %.1f %s\n",stu[j].xuehao,stu[j].name,stu[j].s,stu[j].age,stu[j].score,stu[j].add);
}
return 0;
}
|
31
|
15265
|
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
|
15266
|
struct student
{
char num[20];
char name[20];
char sex[2];
char age[20];
char score[10];
char add[20];
struct student *next;
}*head,*p;
void input()
{
head=NULL;
int n=0;
do
{
p=(struct student *)malloc(LEN);
scanf("%s",p->num);
if(p->num[0]=='e')
break;
scanf("%s%s%s%s%s",p->name,p->sex,&p->age,&p->score,p->add);
n++;
if(n==1)
p->next=NULL;
else
p->next=head;
head=p;
}while(1);
p=head;
}
void output()
{
if(head!=NULL)
{
do
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}while(p!=NULL);
}
}
void main()
{
input();
output();
}
|
31
|
15267
|
void main()
{
struct student{
char a[20];
char b[20];
char c;
int d;
float e;
char f[20];
struct student *next;
};
struct student *head,*p1,*p0;int n=0;
p1=(struct student*) malloc(LEN);
scanf("%s",p1->a);
head=p1;
p1->next=0;
while(strcmp(head->a,"end")!=0)
{
n++;
if(n>1) p1=p0;
scanf("%s %c %d %f %s",head->b,&head->c,&head->d,&head->e,head->f);
p0=(struct student*) malloc(LEN);
head=p0;
p0->next=p1;
scanf("%s",p0->a);
}
head=p1;
for(p1=head;(p1!=0)&&(strcmp(p1->a,"end")!=0);)
{
printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
p1=p1->next;
}
}
|
31
|
15268
|
struct student
{
char id[20];
char name[30];
char sex;
int age;
char score[30];
char add[30];
struct student *next;
struct student *adv;
};
int n;
void main()
{
struct student *p,*q,*head;
n=0;
p=q=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",p->id,p->name,&(*(p)).sex,&(*(p)).age,p->score,p->add);
head=NULL;
while(strcmp(p->id,"end")!=0)
{
n=n+1;
if(n==1) {p->adv=NULL;head=p;}
else q->next=p;
p->adv=q;
q=p;
p=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",p->id,p->name,&p->sex,&p->age,p->score,p->add);
}
q->next=NULL;
while(q!=NULL)
{
if(q!=head)
{printf("%s %s %c %d %s %s\n",q->id,q->name,(*(q)).sex,(*(q)).age,q->score,q->add);
q=q->adv;}
else {printf("%s %s %c %d %s %s\n",head->id,head->name,(*(head)).sex,(*(head)).age,head->score,head->add);break;}
}
}
|
31
|
15269
|
struct stu
{
struct stu *back;
char info[number];
struct stu *next;
}
main()
{
char infos[number];
char s[]="end";
struct stu *head,*p1,*p2,*tail;
gets(infos);
p2=(struct stu *)malloc(Len);
if (strcmp(infos,s)!=0)
{
head=p2;
p2->back=NULL;
strcpy(p2->info,infos);
p2->next=NULL;
gets(infos);
p1=p2;
}
while(strcmp(infos,s)!=0)
{
p2=(struct stu *)malloc(Len);
p1->next=p2;
p2->back=p1;
strcpy(p2->info,infos);
p2->next=NULL;
p1=p2;
gets(infos);
}
tail=p1;
while(p1)
{
printf("%s\n",p1->info);
p1=p1->back;
}
}
|
31
|
15270
|
struct student
{
char xuehao[200];
char name[300];
char xingbie;
char age[20];
char grade[20];
char dizhi[200];
struct student *next;
};
int main()
{
int i;
int n=0;
struct student *tail;
struct student *p1,*p2,*p;
tail=NULL;
p1=p2=NULL;
for(i=1;;)
{
p1=(struct student*)malloc(LEN);
p1->next=p2;
scanf("%s",p1->xuehao);
if(strcmp(p1->xuehao,"end")==0)
{
tail=p2;
break;
}
scanf("%s",p1->name);
getchar();
scanf("%c",&p1->xingbie);
scanf("%s",p1->age);
scanf("%s",p1->grade);
scanf("%s",p1->dizhi);
p2=p1;
i++;
}
n=i-1;
A: p=tail;
for(;p!=NULL;)
{
printf("%s %s %c %s %s %s\n",p->xuehao,p->name,p->xingbie,p->age,p->grade,p->dizhi);
p=p->next;
}
return 0;
}
|
31
|
15271
|
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
|
15272
|
struct arr
{
char num[20];
char name[50];
char sex;
int age;
float score;
char address[50];
struct arr *next;
};
int n;
struct arr *create(void)
{
struct arr *head;
struct arr *p1,*p2;
n=0;
p1=p2=(struct arr *)malloc(LEN);
scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct arr *)malloc(LEN);
scanf("%s",&p1->num );
if(strcmp(p1->num,"end")==0)break;
scanf("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
}
p2->next=NULL;
return(head);
}
struct arr *reverse(struct arr *head)
{
struct arr *p1,*p2,*p3;
p1=p2=head;
if(p1!=NULL&&p1->next!=NULL)
{
p1=p1->next;
p2->next=NULL;
while(p1!=NULL&&p1->next!=NULL)
{
p3=p1;
p1=p1->next;
p3->next=p2;
p2=p3;
}
head=p1;
p1->next=p2;
}
return(head);
}
void print(struct arr *head)
{
int b;
struct arr *p1;
p1=head;
while(p1!=NULL)
{
b=(int)p1->score;
if(p1->score-b==0.0)
printf("%s %s %c %d %d %s\n",p1->num,p1->name,p1->sex,p1->age,b,p1->address);
else
printf("%s %s %c %d %.1f %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
p1=p1->next;
}
}
void freelist(struct arr *head)
{
struct arr *p=head ;
while(p!=NULL)
{
head=head->next;
free(p);
p=head;
}
}
void main()
{
struct arr *head;
head=create();
head=reverse(head);
print(head);
freelist(head);
}
|
31
|
15273
|
struct student
{
char name[50];
struct student *next;
struct student *former;
};//????????
void main()
{
struct student *head1,*head2;
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
gets(p1->name);
p1->next=NULL; //???p1->next???
p1->former=NULL;
head1=p1;
while(strcmp(p1->name,"end"))
{
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->name);
p1->next=NULL;
p1->former=p2;
p2->next=p1;
}
p2->next=NULL;
do
{
puts(p2->name);
p2=p2->former;
}
while(p2!=NULL);
}
|
31
|
15274
|
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
|
15275
|
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
|
15276
|
struct student
{
char num[9];
char name[20];
char sex;
int age;
char grade[6];
char add[11];
struct student*next;
};
int n=0;
void main()
{
struct student *head;
struct student *p1,*p2,*temp,*p=NULL;
p1=p2=(struct student*)malloc(LEN);
scanf("%s",p1->num);
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)break;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->add);
}
p2->next=NULL;
do
{
p2=NULL;
p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(p==NULL)
{
p=p1;
temp=p->next=p2;
}
temp=temp->next=p2;
p2->next=NULL;
}while(head->next!=NULL);
do{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add);
p=p->next;
}while(p!=NULL);
}
|
31
|
15277
|
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
|
15278
|
struct student
{
char str[500];
struct student *next;
struct student *before;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
gets(p1->str);
p1->before=NULL;
head=p1;
while(strcmp(p1->str,"end")!=0){
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->str);
p2->next=p1;
p1->before=p2;
}
p2->next=NULL;
head=p2;
return(head);
}
void main()
{
struct student *p,*head;
head=creat();
p=head;
while(p->before!=NULL)
{printf("%s\n",p->str);
p=p->before;
}
printf("%s",p->str);
}
|
31
|
15279
|
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
|
15280
|
struct student
{
char num[10];
char name[20];
char s;
int age;
char score[20];
char address[30];
struct student *next;
};
int main()
{
struct student *p1,*p2;
p1=(struct student *)malloc(LEN);
p1->next=0;
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->s,&p1->age,&p1->score,p1->address);
while(1)
{
p2=p1;
p1=(struct student *)malloc(LEN);
p1->next=p2;
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->s,&p1->age,&p1->score,p1->address);
if(p1->num[0]== 'e')
break;
}
while(p1->next!=0)
{
p1=p1->next;
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->s,p1->age,p1->score,p1->address);
}
return 0;
}
|
31
|
15281
|
void main()
{
struct student
{
char num[10],name[20],sex,add[15];
int age;
float mark;
struct student * next;
struct student * before;
};
struct student *s1=(struct student *)malloc(sizeof(struct student)),*head=s1,*s2;
(*s1).before=0;
while(1)
{
scanf("%s",(*s1).num);
if((*s1).num[0]!='e')
{
scanf("%s %c %d %f %s",(*s1).name,&((*s1).sex),&((*s1).age),&((*s1).mark),(*s1).add);
s2=(*s1).next=(struct student *)malloc(sizeof(struct student));
(*s2).before=s1;
s1=s2;
}
else
{
head=(*s1).before;
break;
}
}
s1=head;
while(1)
{
printf("%s %s %c %d %g %s\n",(*s1).num,(*s1).name,(*s1).sex,(*s1).age,(*s1).mark,(*s1).add);
if((*s1).before)s1=(*s1).before;
else break;
}
}
|
31
|
15282
|
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
|
15283
|
struct Student
{
char num[10];
char name[25];
char sex;
int age;
float score;
char add[15];
struct Student *next;
};
int main()
{
struct Student *creat(void);
struct Student *head,*p;
head=creat();
p=head;
while(p->next!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
}
struct Student *creat(void)
{
struct Student *head,*news;
int i;
head=NULL;
for(i=0;;i++)
{
news=(struct Student *)malloc(sizeof(struct Student));
scanf("%s",news->num);
if(news->num[0]=='e') break;
scanf(" %s %c %d %f %s",news->name,&news->sex,&news->age,&news->score,news->add);
news->next=head;
head=news;
}
return(head);
}
|
31
|
15284
|
struct student
{
char num[200];
char name[200];
char sex;
int age;
float score;
char address[200];
struct student *next;
};
int num;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
head=NULL;
num=0;
while(1)
{
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if (strcmp(p1->num,"end")==0)
{
p2->next=NULL;
return (head);
break;
}
else
{
scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
if (num==0)
head=p1;
else
p2->next=p1;
p2=p1;
num++;
}
}
}
int main()
{
struct student *pt,*p,*pre;
int i;
pt=creat();
for (i=1;i<=num;i++)
{
for (p=pre=pt;p;p=p->next)
{
if (p->next!=NULL)
pre=p;
else
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
pre->next=NULL;
}
}
}
return 0;
}
|
31
|
15285
|
struct Student
{
char num[41];
char name[41];
char gender[5];
int age;
char score[10];
char address[41];
struct Student * next;
struct Student * pre;
};
int size=sizeof(struct Student);
struct Student gan;
void push ()
{
char ster[41];struct Student * pt;
scanf("%s",ster);
while(strcmp(ster,"end")!=0)
{
pt=malloc(size);
strcpy(pt->num,ster);
scanf("%s %s %d %s %s",pt->name,pt->gender,&pt->age,pt->score,pt->address);
(gan.pre)->next=pt;//????????????next?
pt->pre=gan.pre;//????????????pre?
gan.pre=pt;//??????????????
pt->next=&gan;//???????
scanf("%s",ster);
}
}
void display(struct Student stu)
{
printf("%s %s %s %d %s %s\n",stu.num,stu.name,stu.gender,stu.age,stu.score,stu.address);
}
int main()
{
gan.next=&gan;
gan.pre=&gan;
push();
struct Student * pt;
pt=gan.pre;
while(pt!=&gan)
{
display(*pt);
pt=pt->pre;
}
return 0;
}
|
31
|
15286
|
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
|
15287
|
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
|
15288
|
struct student
{
char seq[10];
char other[100];
struct student *next;
struct student *previous;
};
void main()
{
struct student *p1,*p2;
int n=1;
p1=p2=(struct student *)malloc(LEN);
while(n++)
{
scanf("%s",p1->seq);
if (strcmp(p1->seq,"end")==0) break;
gets(p1->other);
if (n>1) p1->previous=p2;
p2=p1;
p2->next=p1= (struct student *)malloc(LEN);
}
p1=p2;
n=n-1;
for (n;n>1;n--)
{
printf("%s%s\n",p1->seq,p1->other);
p1=p1->previous;
}
}
|
31
|
15289
|
struct node
{
char data[10][20];
struct node *pre;
};
int main ()
{
int i,j;
struct node *p1,*p2;
p1=(struct node *)malloc(sizeof(struct node));
for (i=1;i<=6;i++)
cin>>(*p1).data[i];
p1->pre=NULL;
while((*p1).data[1][0]!='e')
{
p2=(struct node *)malloc(sizeof(struct node));
p2->pre=p1;
for (i=1;i<=6;i++)
cin>>(*p2).data[i];
p1=p2;
}
p1=p1->pre;
while(p1->pre)
{
for (i=1;i<=5;i++)
cout<<(*p1).data[i]<<' ';
cout<<(*p1).data[6]<<endl;
p1=p1->pre;
}
for (i=1;i<=5;i++)
cout<<(*p1).data[i]<<' ';
cout<<(*p1).data[6];
}
|
31
|
15290
|
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
|
15291
|
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
|
15292
|
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
|
15293
|
struct student
{
char ID[10];
char name[20],s;
int age;
char score[10];
char ad[20];
struct student *next;
};
int main()
{
struct student *head;
int n,i,j;
n=0;
head = NULL;
struct student *p1 ;
while (1)
{
p1 = (struct student *)malloc(len);
scanf("%s" , p1 -> ID);
if (p1 -> ID[0] == 'e' && p1 -> ID[1] == 'n' && p1 -> ID[2] == 'd' ) break;
scanf(" %s %c %d %s %s",p1->name,&p1->s,&p1->age,p1->score,p1->ad);
n++;
p1 -> next = head;
head = p1;
}
p1 = head;
while (p1 != NULL)
{
printf("%s %s %c %d %s %s\n",p1->ID,p1->name,p1->s,p1->age,p1->score,p1->ad);
p1 = p1 -> next;
}
}
|
31
|
15294
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
char mark[20];
char add[20];
struct student *next;
};
void main()
{
struct student *creat(void);
struct student *p;
int m=0;
p=creat();
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",(*p).num,(*p).name,(*p).sex,(*p).age,(*p).mark,(*p).add);
p=(*p).next;
} ;
}
int n;
struct student *creat(void)
{ int k;
n=0;
struct student *head,*p1,*p2;
p2=p1=(struct student *)malloc(sizeof(struct student));
scanf("%s%s %c%d%s%s",(*p1).num,(*p1).name,&(*p1).sex,&(*p1).age,(*p1).mark,(*p1).add);
while(p2!=NULL)
{
n=n+1;
if(n==1)
{(*p2).next=NULL;}
else {(*p1).next=p2;}
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",(*p1).num);
k=strcmp((*p1).num,"end");
if(k==0)
{break;}
else if(k!=0)
{
scanf("%s %c%d%s%s",(*p1).name,&(*p1).sex,&(*p1).age,(*p1).mark,(*p1).add);
}
}
return(p2);
}
|
31
|
15295
|
//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
|
15296
|
struct student
{
char number[20];
char name[20];
char sex;
int age;
float score;
char address[20];
struct student *next;
}
main()
{
int i,j,m,n=0;
struct student *head,*p1,*p2,*p;
p1=p2=(struct student *)malloc(LEN);
for(i=0;;i++)
{
scanf("%s",p1->number);
if(strcmp(p1->number,"end")==0)
{
break;
}
else
{
scanf("%s%*c%c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
n+=1;
}
if(i==0)
{
head=p1;
}
else
{
p2->next=p1;
}
p2=p1;
p1=(struct student *)malloc(LEN);
}
p2->next=NULL;
m=n;
for(i=0;i<n;i++)
{
p=head;
for(j=0;j<m-1;j++)
{
p=p->next;
}
printf("%s %s %c %d %g %s\n",p->number,p->name,p->sex,p->age,p->score,p->address);
m-=1;
}
}
|
31
|
15297
|
struct student
{
char num[30];
char name[30];
char s[2];
int age;
float score;
char add[30];
struct student *next;
};
struct student *creat()
{
int n=0;
struct student *head;
struct student *p1;
struct student *p2;
p1=p2=(struct student *)malloc(LEN);
scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->s,&p1->age,&p1->score,p1->add);
p2->next=0;
while(p1->num[0]!='e')
{
n=n+1;
if(n>1)
p1->next=p2;
p2=p1;head=p1;
p1=(struct student *)malloc(LEN);
scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->s,&p1->age,&p1->score,p1->add);
}
return(head);
}
int main()
{
struct student *p=creat();
for(;;)
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->s,p->age,p->score,p->add);
p=p->next;
if(p==0)break;
}
}
|
31
|
15298
|
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
|
15299
|
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);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.