label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
|---|---|---|
31
|
15300
|
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
|
15301
|
struct Student
{
char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct Student *next;
struct Student *front;
};
int n;
void main()
{
struct Student*p1,*p2;
n=0;
p1=p2=(struct Student*)malloc(LEN);
scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
p1->front=NULL;
while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
{
n=n+1;
p2=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
|
15302
|
struct student
{
char a[20];
char b[40];
char c;
int d;
float e;
char f[20];
struct student*before;
};
int n;
struct student* hh()
{
struct student*p1,*p2,*head;n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s ",&p1->a);head=NULL;
while(strcmp(p1->a,"end"))
{
scanf("%s %c %d %f %s ",&p1->b,&p1->c,&p1->d,&p1->e,&p1->f);
n=n+1;
if(n==1)
p1->before=NULL;
else p1->before=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s ",&p1->a);
};
head=p2;
return(head);
}
void main()
{
struct student*p;
p=hh();
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->a,p->b,p->c,p->d,p->e,p->f);
p=p->before;
};
}
|
31
|
15303
|
void main()
{
struct stu
{
char num[100];
char nam[100];
char sex;
int age;
float sco;
char add[100];
struct stu *next;
};
int len=1,i;
struct stu *p1,*p2,*head,*new,*newhead;
p1=p2=head=(struct stu *) malloc(sizeof(struct stu));
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
scanf("%s %c%d%f%s",p1->nam,&p1->sex,&p1->age,&p1->sco,p1->add);
p1=(struct stu *) malloc(sizeof(struct stu));
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0) p2->next=NULL;
else
{
p2->next=p1;
p2=p1;
len++;
}
}
p1=head;
for(i=0;i<len;i++)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(i==0)
newhead=new=p1;
else
new=new->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<len;i++)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->nam,p1->sex,p1->age,p1->sco,p1->add);
p1=p1->next;
}
}
|
31
|
15304
|
struct Node
{
char Info[200];
struct Node *Next;
};
int Insert(struct Node *Head)
{
struct Node *Tmp;
Tmp=(struct Node *)malloc(sizeof(struct Node));
gets(Tmp->Info);
if(strcmp(Tmp->Info,"end")==0)
{
free(Tmp);
return 0;
}
else
{
Tmp->Next=Head->Next;
Head->Next=Tmp;
return 1;
}
}
int main()
{
struct Node *Head,*Tmp;
Head=(struct Node *)malloc(sizeof(struct Node));
Head->Next=NULL;
while(Insert(Head));
Tmp=Head;
while(Tmp->Next!=NULL)
{
Tmp=Tmp->Next;
printf("%s\n",Tmp->Info);
}
return 1;
}
|
31
|
15305
|
struct student
{
char num[200],name[80],sex[20],age[30],score[30],add[200];
struct student *next;
};
struct student *creat()
{struct student *head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
p1->next=0;
while(strcmp(p1->num,"end")!=0)
{ p2=p1;
scanf("%s%s%s%s%s\n",p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=(struct student*)malloc(LEN);
p1->next=p2;
scanf("%s",p1->num);
}
head=p2;
return head;
}
void print (struct student* head)
{ struct student *p;
for(p=head;p!=0;p=p->next)
{ printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
}
}
int main()
{ struct student* head;
head=creat();
print(head);
return 7;
}
|
31
|
15306
|
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
|
15307
|
struct STUDENT
{
char student[100];
struct STUDENT* former;
};
int main()
{
struct STUDENT* p1 = (struct STUDENT*) malloc(sizeof(struct STUDENT));
struct STUDENT* p2;
p1->former = NULL;
for (gets(p1->student);p1->student[0]!='e'; gets(p1->student))
{
p2 = p1;
p1 = (struct STUDENT*) malloc(sizeof(struct STUDENT));
p1->former = p2;
}
for (p1=p1->former; p1!=NULL; p1=p1->former)
{
printf("%s\n", p1->student);
}
return 0;
}
|
31
|
15308
|
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
|
15309
|
struct student
{
char num[10];
char name[30];
char gender;
int age;
char score[10];
char address[30];
struct student *before;
};
void main ()
{
struct student stu[1000], *tail, *p;
int i=0,j;
while (scanf ("%s %s %c %d %s %s",&stu[i].num, &stu[i].name,
&stu[i].gender, &stu[i].age, &stu[i].score, &stu[i].address)!=EOF)
i++;
// for (i=0;stu[i].num[0]!='e';i++)
// {
// scanf ("%s %s %c %d %d %s",stu[i].num, stu[i].name,
// &stu[i].gender, &stu[i].age, &stu[i].score, stu[i].address);
// }
tail=&stu[i-1];
for (j=i-1;j>=0;j--)
stu[j].before=&stu[j-1];
stu[0].before=0;
p=tail->before;
do
{
printf ("%s %s %c %d %s %s\n",p->num, p->name, p->gender,
p->age, p->score, p->address);
p=p->before;
}
while (p!=0);
}
|
31
|
15310
|
struct student
{char c[300];
struct student *next;
};
int n;
struct student * create()
{struct student *head,*p1,*p2;
n=0;
p1=p2=head=(struct student*)malloc(Len);
gets(head->c);
head->next=0;
while (strcmp("end",p1->c)!=0)
{head=p1;
p1=(struct student*)malloc(Len);
p1->next=head;
gets(p1->c);
}
return head;
}
int main()
{ struct student *start;
start=(struct student*)create();
do
{printf("%s\n",start->c);
start=start->next;
}while (start->next!=0);
printf("%s\n",start->c);
return 7;
}
|
31
|
15311
|
struct stu
{
char num[20],name[20],add[30],sex;
int age;
float score;
struct stu *next;
}
main()
{
struct stu *p1,*p2;
p1=(struct stu*)malloc(len);
p1->next=NULL;
while(1)
{
scanf("%s",p1->num);
if(!strcmp(p1->num,"end")) break;
scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
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->add);
p1=p1->next;
}
}
|
31
|
15312
|
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
|
15313
|
struct student
{
char what[100];
struct student *last;
};
void print(struct student *p)
{
printf("%s\n",p->what);
if(p->last!=NULL)print(p->last);
}
main()
{
struct student stu,*head,*tail,*p1,*p2;
tail=(struct student*)malloc(LEN);
tail->last=NULL;
gets(tail->what);
p1=tail;
while(strcmp(p1->what,"end")!=0)
{
p2=(struct student*)malloc(LEN);
p2->last=p1;
gets(p2->what);
p1=p2;
}
head=p1->last;
print(head);
}
|
31
|
15314
|
struct student
{
char ID[20];
char name[20];
char sex;
int age;
char score[20];
char address[20];
struct student*next;
};
struct student*creat()
{
struct student*head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->ID,p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
head=p1;
p2=p1;
do
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->ID);
if(strcmp("end",p1->ID)==0)
{
break;
}
else
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
}while(1);
return(head);
}
void print(struct student*head)
{
struct student*p,*ppr;
while(head->next!=NULL)
{
ppr=head;
p=head->next;
while(p->next!=NULL)
{
ppr=p;
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address);
ppr->next=NULL;
}
printf("%s %s %c %d %s %s\n",head->ID,head->name,head->sex,head->age,head->score,head->address);
}
int main()
{
struct student*head;
head=creat();
print(head);
}
|
31
|
15315
|
struct student
{char num[20];
char name[20];
char sex;
int age;
float score;
char address[20];
struct student *next;
};
void main()
{
struct student *p1,*p2,*head,*p;
p1=p2=(struct student *) malloc(LEN);
scanf("%s",p1->num);
p1->next=NULL;
while(p1->num[0]!='e')
{
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
p1=(struct student *) malloc(LEN);
p1->next=p2;
p2=p1;
scanf("%s",p1->num);
}
p=head=p2->next;
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;
}
}
|
31
|
15316
|
struct stu{
char info[50];
struct stu *next;
};
int main(int argc, char* argv[])
{
struct stu *head,*p1,*p2;
p2=NULL;
while(1){
p1=(struct stu*)malloc(LEN);
gets(p1->info);
if(strcmp(p1->info,"end")==0){
break;
}
p1->next=p2;
p2=p1;
}
head=p2;
p1=head;
while(1){
printf("%s\n",p1->info);
if(p1->next==NULL){
break;
}
p1=p1->next;
free(p2);
p2=p1;
}
return 0;
}
|
31
|
15317
|
struct student
{
char id[1000];
struct student *pre,*next;
};
void main()
{
struct student *p1,*p2,*head1,*head2;
int n=0;
char temp[1000];
p1=p2=NULL;
while(gets(temp),strcmp(temp,"end")!=0)
{
n=n+1;
p1=(struct student *)malloc(sizeof(struct student));
p1->pre=NULL;
p1->next=NULL;
head1=NULL;
strcpy(p1->id,temp);
if(n==1)head1=p1;else {p2->next=p1;p1->pre=p2;}
p2=p1;
}
head2=p2;
while(p2!=NULL)
{
printf("%s\n",p2->id);
p2=p2->pre;
}
}
|
31
|
15318
|
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
|
15319
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
char score[10];
char add[20];
struct student *next;
};
int n=0;
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=p2=(struct student *)malloc(LEN);
head=NULL;
scanf("%s",p1->num);
if(p1->num[0]=='e')
return(head);
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
p1->next=NULL;
while(p1->num[0]!='e')
{
n=n+1;
head=p1;
if(n>1)
{
p1->next=p2;
p2=p1;
}
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(p1->num[0]=='e')
break;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15320
|
struct student
{
char num[10];
char name[30];
char sex;
int age;
char score[10];
char address[20];
struct student *next;
};
struct student *creat()
{
struct student *head,*p;
head=(struct student*)malloc(Len);
scanf("%s",head->num);
if(strcmp(head->num,"end")==0) head=NULL;
else scanf("%s %c %d %s %s",head->name,&head->sex,&head->age,head->score,head->address);
head->next=NULL;
while(1)
{
p=head;
head=(struct student*)malloc(Len);
scanf("%s",head->num);
if(strcmp(head->num,"end")==0) {head=p;break;}
else scanf("%s %c %d %s %s",head->name,&head->sex,&head->age,head->score,head->address);
head->next=p;
}
return head;
}
void print(struct student *head)
{struct student *q;
q=head;
while(q){printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->address);
q=q->next;}
}
void main()
{
print(creat());
}
|
31
|
15321
|
struct student
{
char num[100];
struct student *next;
};
main()
{
int n,i;
struct student *head,*p1,*p2,*p;
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) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*) malloc(LEN);
gets(p1->num);
}
p2->next=NULL;
for(i=0;i<n;i++)
{
p=head;
while(p->next!=NULL)
{
p1=p;
p=p->next;
}
printf("%s\n",p->num);
p1->next=NULL;
}
}
|
31
|
15322
|
struct student
{
char ID[20];
char name[20];
char sex;
int age;
char score[20];
char address[20];
struct student *next;
};
struct student *create()
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;}
else
{
head=p1;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
p2=p1;
do
{
p1=(struct student*)malloc(LEN);
p1->next=NULL;
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){p2->next=NULL;free(p1);break;}
else
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p2->next=p1;
p1->next=NULL;
p2=p1;
}
}while(1);
}
return(head);
}
struct student *fanxu(struct student *head)
{
struct student *prep,*nowp,*nextp;
prep=NULL;
nowp=head;
while(nowp)
{
nextp=nowp->next;
nowp->next=prep;
prep=nowp;
nowp=nextp;
}
return prep;
}
void print(struct student *head)
{
struct student *p;
p=head;
while(p)
{
printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
}
int main()
{
struct student *head;
head=create();
head=fanxu(head);
print(head);
}
|
31
|
15323
|
void main()
{
char s[1000][100];
int i=0,k;
gets(s[0]);
while(s[i][0]!='e')
{
i=i+1;
gets(s[i]);
}
for(k=i-1;k>=0;k--)
{
puts(s[k]);
}
}
|
31
|
15324
|
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
|
15325
|
struct stu
{
char id[500];
struct stu *next;
struct stu *pre;
};
void main()
{
int n;
struct stu *p1,*p2,*head,*tail,*p;
n=0;
p1=p2=(struct stu*)malloc(sizeof(struct stu));
gets(p1->id);
while(strcmp(p1->id,"end")!=0)
{
n=n+1;
if(n==1)
{
head=p1;
p1->pre=NULL;
}
else
{
p2->next=p1;
p1->pre=p2;
}
p2=p1;
p1=(struct stu*)malloc(sizeof(struct stu));
gets(p1->id);
}
p2->next=NULL;
tail=p2;
p=tail;
do
{
printf("%s\n",p->id);
p=p->pre;
}while(p!=NULL);
}
|
31
|
15326
|
/*
* 78.cpp
* ??????
* Created on: 2011-12-11
* ??????????????????????????????????????????
*/
int main()
{
int i,j;
struct
{
char number[40];
char name[40];
char sex;
int old;
double point;
char address[40];
}student[1000];
for(i=0;i<1000;i++)
{
cin>>student[i].number;
if((student[i].number[0]=='e')&&(student[i].number[1]=='n')&&(student[i].number[2]=='d')&&(student[i].number[3]=='\0')) break;
cin>>student[i].name>>student[i].sex>>student[i].old>>student[i].point>>student[i].address;
}
for(j=i-1;j>=0;j--)
{
cout<<student[j].number<<" "<<student[j].name<<" "<<student[j].sex<<" "<<student[j].old<<" "<<student[j].point<<" "<<student[j].address<<endl;
}
return 0;
}
|
31
|
15327
|
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 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);
}
|
31
|
15328
|
struct student
{
char num[20];
char name[20];
char gender;
int age;
char score[20];
char add[200];
struct student *prev;
struct student *next;//????????????
}*head=0,*tail=0;
void add_node(char*a,char*b,char c,int d,char* e,char* f)
{
if(head==0)
{
head=tail=(struct student*)malloc(sizeof(struct student));//???????
tail->next=tail->prev=0;
}
else
{
struct student *tmp=tail;
tail=tail->next=(struct student*)malloc(sizeof(struct student));
tail->prev=tmp;
tail->next=0;
}
strcpy(tail->num,a);
strcpy(tail->name,b);
strcpy(tail->add,f);
strcpy(tail->score,e);
tail->gender=c;
tail->age=d;
}
void print()//????????
{
while(tail)
{
printf("%s %s %c %d %s %s\n",tail->num,tail->name,tail->gender,tail->age,tail->score,tail->add);
tail=tail->prev;
}
}
int main()
{
char a[20];
char b[20];
char c;
int d;
char e[20];
char f[200];
scanf("%s",a);
while(strcmp(a,"end"))
{
scanf("%s %c %d %s %s",b,&c,&d,e,f);
add_node(a,b,c,d,e,f);
scanf("%s",a);
}
print();
return 0;
}
|
31
|
15329
|
struct student
{
char num[10],name[50],addr[50],score[10],sex;
int age;
struct student *before;
};
void main()
{
struct student *p1=0,*p2;
p2=(struct student *)malloc(len);
while(scanf("%s %s %c %d %s %s",p2->num,p2->name,&(p2->sex),&(p2->age),p2->score,p2->addr)!=EOF)
{
if(p2->num[0]=='e')
break;
p2->before=p1;
p1=p2;
//printf("%s %s %c %d %d %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->addr);
p2=(struct student *)malloc(len);
}
p2=p1;
while(p2!=0)
{
printf("%s %s %c %d %s %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->addr);
p2=p2->before;
}
getchar();
getchar();
}
|
31
|
15330
|
int main()
{
struct student
{
char a[100];
struct student *back;
};
int n;
struct student *p1,*p2,*end;
p1=p2=(struct student *)malloc(sizeof(struct student));
gets(p1->a);
p1->back=0;
for (n=1;;n++)
{
p1=(struct student * )malloc(sizeof(struct student));
p1->back=p2;
p2=p1;
gets(p1->a);
if (p1->a[0]=='e')
{
end=p1->back;
break;
}
}
struct student *p;
p=end;
for (n=1;;n++)
{
printf("%s\n",p->a);
p=p->back;
if (p==0)break;
}
return 0;
}
|
31
|
15331
|
struct student
{
char a[60];
struct student*next;
};
void main()
{
struct student *creat(void);
struct student *p;
p=creat();
for(;p!=NULL;)
{
puts(p->a);
p=p->next;
}
}
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int n=0;
p1=p2=(struct student *)malloc(LEN);
gets(p1->a);
for(;;)
{
n=n+1;
if(n==1)p2->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->a);
if(p1->a[0]=='e')
{head=p2;
return (head);}
}
}
|
31
|
15332
|
struct stu
{
char infor[50];
struct stu*previous;
};
void main()
{
struct stu*p,*q,*head;
p=(struct stu*)malloc(sizeof(struct stu));
p->previous=NULL;
gets(p->infor);
while(strcmp(p->infor,"end")!=0)
{
q=(struct stu*)malloc(sizeof(struct stu));
q->previous=p;
p=q;
gets(p->infor);
}
head=p->previous;
for(p=head;p!=NULL;p=p->previous)
puts(p->infor);
}
|
31
|
15333
|
struct stu
{
char num[40];
char name[40];
char sex[10];
char year[10];
char score[40];
char add[40];
struct stu *fw;
struct stu *bw;
};
int n;
struct stu *tail;
struct stu *create(void)
{
int i;
struct stu *head,*p1,*p2;
head=(struct stu *)malloc(sizeof(struct stu));
head->fw=NULL;
head->bw=NULL;
p2=head;
while(1)
{
p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{
p1->fw=NULL;
p2->fw=p1;
p1->bw=p2;
tail=p1;
break;
}
else
{
scanf("%s %s %s %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add);
p1->fw=NULL;
p2->fw=p1;
p1->bw=p2;
p2=p1;
}
}
return head;
}
void bwprint(struct stu *ptail)
{
struct stu *p;
p=ptail->bw;
while(p->bw!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add);
p=p->bw;
}
}
main()
{
int k=0;
stu *p1;
struct stu *pheader;
pheader=create();
bwprint(tail);
}
|
31
|
15334
|
struct student
{
char num[20];
char name[20];
char sex[5];
int age;
char score[10];
char address[30];
struct student *next;
};
int n;
int main()
{
struct student *p1,*p2,*p;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
n++;
if(n==1)p1->next=NULL;
scanf("%s%s%d%s%s\n",p1->name,p1->sex,&p1->age,p1->score,p1->address);
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
p1->next=p2;
p2=p1;
}
p=p1->next;
while(p!=0)
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
return 0;
}
|
31
|
15335
|
struct student
{
char inf[100];
struct student*next;
};
int n;
struct student*creat(void)
{
struct student*head;
struct student*p1,*end;
n=0;
p1=(struct student*) malloc(LEN);
gets(p1->inf);
head=end=NULL;
while(strcmp(p1->inf,"end")!=0)
{
n=n+1;
if(n==1)
{
p1->next=head;
end=p1;
}
else {p1->next=end;
end=p1;}
p1=(struct student*) malloc(LEN);
gets(p1->inf);
}
return end;
}
void print(struct student*end)
{
struct student *p1;
p1=end;
while(p1!=NULL)
{
printf("%s\n",p1->inf);
p1=p1->next;
}
}
void main()
{
struct student *end;
end=creat();
print(end);
}
|
31
|
15336
|
int main()
{
struct joyan
{
char num[10];
char name[20];
char sex[1];
int age;
float score;
char add[20];
struct joyan * next;
};
struct joyan *head,*p1,*p2;
p1=p2=head=(struct joyan *)malloc(LEN);
scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->sex,&p1->age,&p1->score,p1->add);
p1->next = NULL;
int n=1,i;
while(p1->num[0]>='0'&&p1->num[0]<='9')
{
p1=(struct joyan *)malloc(LEN);
scanf("%s",p1->num);
if (p1->num[0]!='e')
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
p2->next=p1;
p2=p1;
n++;
}
else
{
p2->next=NULL;
break;
}
}
struct joyan *p,*q,*temp;
p=head;
if(p->next!=NULL)
{
q=p->next;
if(q->next==NULL)
{
p->next=NULL;
q->next=p;
}
else
{
p->next=NULL;
temp=p;
p=q;
q=q->next;
while(q->next!=NULL)
{
p->next=temp;
temp=p;
p=q;
q=q->next;
}
p->next=temp;
q->next=p;
}
head=q;
}
p1=head;
for(i=0;i<n;i++)
{
printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
return 0;
}
|
31
|
15337
|
//
// main.c
// Track 82,????????????
//
// Created by Charles.thRay.Lee on 2/1/13.
// Copyright (c) 2013 Peking University. All rights reserved.
/*
??
???????????????????????????????????????
????
?????????????????????
00630018 zhouyan m 20 10.0 28#460
??????"end"??
????
??????????
?????????
?? ?? ?? ?? ?? ??
?????
????
00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
end
????
10630018 zouan m 20 10 28#46000
0630018 zuyan m 21 100 28#4600
01030018 houyan m 20 10 28#4600
00160018 zouyan f 21 100 28#4600
00613018 zhuyan m 20 100 28#4600
0063018 zhouan m 21 10000 28#4600000
0063008 zhoyan f 20 1000 28#460000
0063001 zhouyn f 21 100 28#460000
00630018 zhouyan m 20 10 28#4600
*/
struct Student
{
char num[20];
char name[20];
char gender;
int age;
char score[10];
char address[20];
struct Student*next;
struct Student*upper;
};
int n;
struct Student*creat(void)
{
struct Student*head,*end;
struct Student*p1,*p2;
n=0;
p1=p2=(struct Student*)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->gender,&p1->age,p1->score,p1->address);
head=NULL;
while (p1->num[0]!='e') {
n=n+1;
if (n==1)
{
head=p1;
p1->upper=NULL;
}
else
{
p2->next=p1;
p1->upper=p2;
}
p2=p1;
p1=(struct Student*)malloc(LEN);
scanf("%s",p1->num);
if (p1->num[0]=='e') {
end=p2;
break;
}
scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->address);
}
p2->next=NULL;
return (end);
}
int main()
{
struct Student *pt;
pt=creat();
do {
printf("%s %s %c %d %s %s\n",pt->num,pt->name,pt->gender,pt->age,pt->score,pt->address);
pt=pt->upper;
} while (pt!=NULL);
return 0;
}
|
31
|
15338
|
struct student
{
char id[20];
char name[20];
char sex;
int age;
char score[20];
char addr[20];
struct student *next;
struct student *before;
};
int n;
struct student *creat(void)
{
struct student *head,*p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s",p1->id);
head=NULL;
while(strcmp(p1->id,"end")!=0)
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
p1->before=p2;
scanf("%s",p1->id);
}
p2->next=NULL;
return(p2);
}
void main()
{
struct student *p;
int i;
p=creat();
printf("%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr);
for(i=1;i<n;i++)
{
p=p->before;
printf("\n%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr);
}
}
|
31
|
15339
|
/*?? ?? ?? ?? ?? ??*/
struct student
{
struct student *pre;
char num[100];
char name[20];
char sex[2];
char age[10];
char score[10];
char ad[100];
struct student *next;
};
void main()
{
int n=0;
struct student *end,*p1,*p2,*p;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->ad);
n=n+1;
if(n==1)
{
p1->pre=NULL;
p2=p1;
}
else
p1->pre=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
}
p=p2;
do
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad);
p=p->pre;
}while(p!=NULL);
}
|
31
|
15340
|
struct student
{
char num[1000];
struct student *next;
};
int main()
{
struct student s[1000],*p,*pheader;
int i=0;
int n;
char ch;
for (i=0;;i++)
{
gets(s[i].num);
if (strcmp(s[i].num,"end")==0)
break;
}
n=i;
pheader=&s[n-1];
for (i=n-1;i>=1;i--)
{
s[i].next=&s[i-1];
}
s[0].next=NULL;
p=pheader;
while (p!=NULL)
{
puts(p->num);
p=p->next;
}
return 0;
}
|
31
|
15341
|
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
|
15342
|
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
|
15343
|
struct student
{ char s[100];
struct student *next;
};
struct student *creat()
{
struct student *head,*p1,*p2;
p1=(struct student *)malloc(len);
gets(p1->s);
p1->next=null;
do
{
p2=(struct student *)malloc(len);
gets(p2->s);
p2->next=p1;
p1=p2;
} while(strcmp(p2->s,"end"));
head=p2;
return(head);
}
void main()
{
struct student *p,*head;
head=creat();
p=head;
while(p->next){
p=p->next;
printf("%s\n",p->s);
}
}
|
31
|
15344
|
struct stu{
char num[20];
char name[20];
char gen;
int age;
float mark;
char add[20];
struct stu *next;
};
char end[4]="end";
int main()
{
struct stu *p1,*p2,t;
p1=p2=NULL;
while(scanf("%s",t.num),strcmp(t.num,end)!=0)
{
scanf("%s %c %d %g %s\n",t.name,&t.gen,&t.age,&t.mark,t.add);
p1=(struct stu *)malloc(LEN);
*p1=t;
p1->next=p2;
p2=p1;
}
while(p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->gen,p1->age,p1->mark,p1->add);
p1=p1->next;
}
}
|
31
|
15345
|
struct student
{
char input[500];
struct student *next;
};
void main()
{
char c[500];
struct student *head;
struct student *p1,*p;
head=NULL;
while(strcmp(gets(c),"end")!=0)
{
p1=(struct student *)malloc(LEN);
strcpy(p1->input,c);
p1->next=head;
head=p1;
}
p=head;
do
{
puts(p->input);
p=p->next;
putchar('\n');
}while(p!=NULL);
}
|
31
|
15346
|
struct stu
{
char id[10];
char name[20];
char sex;
int age;
char score[10];
char addr[20];
struct stu *next;
};
int main()
{
struct stu *creat(void);
void output(struct stu*head);
struct stu *head,*p;
head=NULL;
head=creat();
p=head;
output(head);
}
struct stu *creat(void)
{
int i;
struct stu*p1,*p2,*p3,*head;
head=NULL;
p1=(struct stu*)malloc(LEN);
if(head==NULL) head=p2=p3=p1;p1->next=NULL;
scanf("%s",p1->id);
while(p1->id[0]!='e')
{
p3=p2;
scanf(" %s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
p1=(struct stu*)malloc(LEN);
p1->next=p2;
p2=p1;
scanf("%s",p1->id);
}
head=p3;
return head;
}
void output(struct stu*head)
{
struct stu*p1,*p2;
p1=head;
while(p1!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->next;
}
}
|
31
|
15347
|
struct stud
{ char no[50];
char name[50];
char sex;
int y;
char sc[30];
char addr[50];
struct stud *pre;
};
struct stud *creat()
{ struct stud *p1,*p2;
char *g="end";
p1=p2=(struct stud *) malloc(LEN);
p1->pre=NULL;
scanf("%s",p1->no);
while(strcmp(p1->no,g))
{ scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->y,p1->sc,p1->addr);
p2=p1;
p1=(struct stud *) malloc(LEN);if(p1==NULL) return NULL;
p1->pre=p2;
scanf("%s",p1->no);
}
return (p1->pre);
}
void main()
{
struct stud *pt;
pt=creat();
while(pt!=NULL)
{
printf("%s %s %c %d %s %s\n",pt->no,pt->name,pt->sex,pt->y,pt->sc,pt->addr);
pt=pt->pre;
}
}
|
31
|
15348
|
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
|
15349
|
struct student
{char a[50];
struct student *prev;
};
void main()
{
void print(struct student *head);
int n=0;
struct student *head;
struct student *p1,*p2;
p1=head=(struct student *)malloc(len);/*???????*/
gets(p1->a);
p2=NULL;
while(strcmp(p1->a,"end")!=0)
{
n++;
if(n==1)
p2=p1;
else
p1->prev=head;
head=p1;
p1=(struct student *)malloc(len);
gets(p1->a);
}
p2->prev=NULL;
print(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
do
{
printf("%s\n",p->a);
p=p->prev;
}
while(p!=NULL);
}
|
31
|
15350
|
struct a
{
char s[6][100];
struct a *next;
}head;
int tot=0;
void init()
{
int i;
struct a *p;
head.next=NULL;
while(1)
{
p=(struct a *)malloc(sizeof(struct a));
scanf("%s",p->s[0]);
if(!strcmp(p->s[0],"end")) break;
for(i=1;i<6;i++)
{
scanf("%s",p->s[i]);
}
p->next=head.next;
head.next=p;
}
}
void print()
{
struct a *p=head.next;
int i;
while(p)
{
for(i=0;i<5;i++)
{
printf("%s ",p->s[i]);
}
puts(p->s[i]);
p=p->next;
}
}
int main()
{
init();
print();
return 0;
}
|
31
|
15351
|
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
|
15352
|
struct s
{
char xh[50];
char xm[55];
char xb;
int nl;
char df[50];
char dz[50];
struct s *next;
};
void main()
{
struct s *head,*p1,*p2,*p;
p2=(struct s *)malloc(len);
scanf("%s",p2->xh);
p2->next=NULL;
while(strcmp(p2->xh,"end")!=0)
{
scanf("%s",p2->xm);
scanf(" %c",&p2->xb);
scanf(" %d",&p2->nl);
scanf(" %s",p2->df);
scanf(" %s",p2->dz);
head=p2;
p1=p2;
p2=(struct s *)malloc(len);
scanf("%s",p2->xh);
p2->next=p1;
}
p=head;
while(p!=NULL)
{printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->xb,p->nl,p->df,p->dz);
p=p->next;}
}
|
31
|
15353
|
struct student
{
char num[20];
char name[30];
char sex;
int age;
char score[20];
char add[40];
struct student *next;
};
void main()
{
struct student *p1,*head;
head=(struct student *)malloc(L);
p1=head->next=NULL;
scanf("%s",head->num);
while(strcmp(head->num,"end")!=0)
{
p1=head;
scanf(" %s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
head=(struct student *)malloc(L);
head->next=p1;
scanf("%s",head->num);
}
free(head);
head=p1;
while(p1!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
}
|
31
|
15354
|
struct student
{
char id[50];
char *name;
char sex;
short int age;
float score;
char *add;
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *p1,*head,*p2;
n=0;
head=NULL;
p2=p1=(struct student*)malloc(sizeof(struct student));
gets(p1->id);
while(strcmp(p1->id,"end")!=0)
{
n++;
if(n==1)
p1->next=NULL;
else
{ p1->next=p2;
}
p2=p1;
head=p2;
p1=(struct student*)malloc(sizeof(struct student));
gets(p1->id);
}
return head;
}
void print(struct student *head)
{
struct student *p;
p=head;
while(p!=NULL)
{
printf("%s\n",p->id);
p=p->next;
}
}
main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15355
|
struct Student
{
char imf[100];
struct Student *next,*pre;
};
int main()
{
struct Student *p,*q,*h;
h=p=q=malloc(LEN);
gets(q->imf);
q->pre=q->next=NULL;
while(strcmp(q->imf,"end")!=0)
{
p=q;
q=malloc(LEN);
q->next=NULL;
q->pre=p;
p->next=q;
gets(q->imf);
}
while(p!=NULL)
{
puts(p->imf);
p=p->pre;
}
}
|
31
|
15356
|
struct student
{
char s[10];
char name[30];
char sex;
char age[3];
char score[6];
char place[15];
struct student *next;
struct student *last;
};
int n;
struct student *creat()
{
struct student *head1,*head2;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(100);
head1=NULL;scanf("%s ",&p1->s);
do
{
scanf("%s %c %s %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->place);
n=n+1;
if(n==1)
{head1=p1;p1->last=NULL;}
else {p2->next=p1;p1->last=p2;
p2=p1;}p1=(struct student*)malloc(100);scanf("%s",&p1->s);
}while(p1->s[0]!='e');head2=p2;
p2->next=NULL;
return(head2);
}
void main()
{
struct student *p1;
p1=creat();
do{printf("%s %s %c %s %s %s\n",p1->s,p1->name,p1->sex,p1->age,p1->score,p1->place);
p1=p1->last;
}while(p1!=NULL);
}
|
31
|
15357
|
struct stu
{
char a[100];
struct stu *prev;
struct stu *next;
};
void main()
{
struct stu *end,*p1,*p2,*head;
int m,n,j;
p1=(struct stu*)malloc(sizeof(struct stu));
end=p1;
p2=p1;
gets(p1->a);
p1->next=0;
scanf("\n");
for(;;)
{
p1=(struct stu*)malloc(sizeof(struct stu));
gets(p1->a);
scanf("\n");
if(strcmp(p1->a,"end")==0)
{
head=p2;
break;
}
else
{
p1->next=p2;
p2=p1;
}
}
for(;head!=0;head=head->next)
{
puts(head->a);
}
}
|
31
|
15358
|
struct student
{
char num[30];
char name[40];
char sex[2];
int age;
float score;
char add[50];
struct student *next;
};
int n;
struct student *creat()
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=( struct student * ) malloc(LEN);
scanf("%s",p1->num);
head=0;
while(strcmp(p1->num,"end")!=0)
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
n++;
if(n==1) p2->next=0;
else p1->next=p2;
p2=p1;
p1=( struct student * ) malloc(LEN);
scanf("%s",p1->num);
}
head=p2;
return(head);
}
void print(struct student * head)
{
struct student * p;
p=head;
if(head!=0)
do
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}while(p!=0);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15359
|
struct Student
{
char id[100];
char name[300];
int age;
char sex;
char score[100];
char address[300];
struct Student *before;
}s[2500];
main()
{
struct Student *p,*q,*head;
int i=0,j,k,n,m;
scanf("%s",&s[0].id);
p=&s[0];
q=NULL;
while (p!=NULL)
{
scanf("%s %c%d%s%s",p->name,&p->sex,&p->age,p->score,p->address);
p->before=q;
q=p;
scanf("%s",&s[i+1].id);
if (strcmp(s[i+1].id,"end")==0)
{
p=NULL;
head=q;
}
else {
p=&s[i+1];
i++;
}
}
p=head;q=NULL;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address);
p=p->before;
}
}
|
31
|
15360
|
struct stu
{ //????????
char stunum[10];
char name[20];
char sex[3];
char age[10];
char mark[10];
char add[20];
struct stu *next,*before;//??
};
void main()
{
struct stu *p,*pt,*head;
int i=0,n=0;
char a[4];
strcpy(a, "end");
pt=p=head=(struct stu *)malloc(Len);
for(i=0;;i++)
{
scanf("%s",&p->stunum);
if(strcmp(p->stunum,a)==0)
{
pt->next=NULL;break;
}
scanf("%s %s %s %s %s",&p->name,&p->sex,&p->age,&p->mark,&p->add);
pt=p;
p=(struct stu *)malloc(Len);
pt->next=p;
p->before=pt;
}
p=pt;
if(p!=head)
{
for(i=0;;i++)
{
printf("%s %s %s %s %s %s",&p->stunum,&p->name,&p->sex,&p->age,&p->mark,&p->add);
if(p==head)
break;
printf("\n");
p=p->before;
}
}
printf("\n");
}
|
31
|
15361
|
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
|
15362
|
struct Student
{
char stu[500];
struct Student * next;
};
int n=0;
void main()
{
struct Student * creat();
void print(struct Student *head,int num);
struct Student *head;
head=creat();
int i=0;
for(i=n;i>0;i--)
print(head,i);
}
struct Student * creat()
{
struct Student *p1,*p2;
struct Student *head;
head=NULL;
p1=p2=(struct Student *)malloc(LEN);
gets(p1->stu);
while(strcmp(p1->stu,"end")!=0)
{
n=n+1;
if(n==1)
{
head=p1;
}
else
{
p2->next=p1;
}
p2=p1;
p1=(struct Student *)malloc(LEN);
gets(p1->stu);
}
p2->next=NULL;
return(head);
}
void print(struct Student *head,int num)
{
struct Student *p;
p=head;
int count=1;
while(count<num)
{
p=p->next;
count+=1;
}
printf("%s\n",p->stu);
}
|
31
|
15363
|
main()
{
struct h
{char mun[10];
char name[20];
char sex;
int age;
float score;
char add[20];
struct h *p;
} ;
struct h *a,*b;
a=len;
a->p=NULL;
int i;
for(i=0;i<1000;i++)
{scanf("%s",a->mun);
if(!strcmp(a->mun,"end")) break;
scanf("%s %c %d %f %s",a->name,&a->sex,&a->age,&a->score,a->add);
b=len;
b->p=a;
a=b;}
a=a->p;
while(a)
{
printf("%s %s %c %d %g %s\n",a->mun,a->name,a->sex,a->age,a->score,a->add);
a=a->p;
}
}
|
31
|
15364
|
struct student
{
char inf[200];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=(struct student *)malloc(LEN);
p2=p1;
gets(p1->inf);
head=NULL;
do
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->inf);
}
while(strcmp((p1->inf),"end")!=0);
p2->next=NULL;
return(head);
}
int main()
{
struct student *r,*headr;
r=creat();
headr=r;
r=r->next;
for(;r!=headr;)
{
for(r=headr;r->next!=NULL;)r=r->next;
printf("%s\n",r->inf);
for(r=headr;(r->next)->next!=NULL;)r=r->next;
r->next=NULL;
}
printf("%s",headr->inf);
}
|
31
|
15365
|
struct student
{
char infor[100];
struct student *next;
};
struct student *creat(void)
{ struct student *head;
struct student *p1,*p2;
int n;
char l[4]={"end"};
n=0;
p1=p2=(struct student *)malloc(LEN);
gets(p1->infor);
head=NULL;
while(strcmp(p1->infor,l)!=0)
{ n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->infor);
}
p2->next=NULL;
return(head);
}
void print(struct student *head)
{
struct student *p,*p1,*p2;
p=p1=p2=head;
p2=p->next;
p1=p2->next;
head->next=NULL;
for(;p1->next!=NULL;)
{
p2->next=p;
p=p2;
p2=p1;
p1=p1->next;
}
p2->next=p;
p1->next=p2;
head=p1;
p=head;
for(;p!=NULL;)
{printf("%s\n",p->infor);
p=p->next;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15366
|
int n=1;
struct student
{char num[20];
char name[20];
char sex;
int age;
char score[10];
char ad[20];
struct student *next;
};
struct student* appendnewnode(void)
{
struct student *newnode,*thisnode;
int x;
do{
newnode=(struct student*)malloc(sizeof(struct student));
scanf("%s",newnode->num);
getchar();
x=strcmp(newnode->num,"end");
if(x!=0){
scanf("%s %c %d %s %s",newnode->name ,&newnode->sex ,&newnode->age ,newnode->score ,newnode->ad);
if(n==1)
{
newnode->next =0;
}
else
{
newnode->next =thisnode;
}
thisnode=newnode;
n++;
}
}while(x!=0);
return(thisnode);
}
void main()
{
struct student *p,*head;
head=appendnewnode();
p=head;
do
{
printf("%s %s %c %d %s %s\n",p->num ,p->name ,p->sex ,p->age ,p->score ,p->ad);
p=p->next ;
}while(p!=NULL);
}
|
31
|
15367
|
struct Student{
char stu[100];
struct Student *next;
};
int main()
{
struct Student *p,*head,*p1,*p2;
int n = 0;
p2 = p1 = (struct Student *)malloc(Len);
head = NULL;
gets(p1->stu);
while(strcmp(p1->stu,"end")!=0){
n++;
head = p1;
if (n==1) p1->next = NULL;
else{
p1->next = p2;
p2 = p1;
}
p1 = (struct Student *)malloc(Len);
gets(p1->stu);
}
p = head;
if (head != NULL){
do{
puts(p->stu);
p=p->next;
}while(p != NULL);
}
return 0;
}
|
31
|
15368
|
struct xinxi
{
char stu[1000];
struct xinxi *next;
};
void main()
{
struct xinxi *head,*p,*pt;
int i,n;
p=(struct xinxi *)malloc(sizeof(struct xinxi));
gets(p->stu);
pt=p;
head=(struct xinxi *)malloc(sizeof(struct xinxi));
n=0;
while(strcmp(p->stu,"end")!=0)
{ n=n+1;
if(n==1)head->next=p;
if(n>1)pt->next=p;
pt=p;
p=(struct xinxi *)malloc(sizeof(struct xinxi));
n=n+1;
gets(p->stu);
}
pt->next=NULL;
while(head->next!=NULL)
{ pt=head;
p=head->next;
while(p->next!=NULL)
{p=p->next;
pt=pt->next;}
puts(p->stu);
pt->next=NULL;
}
}
|
31
|
15369
|
struct stu
{
char inf[100];
struct stu *next;
};
void down(struct stu *now)
{
if (now->next!=0) down(now->next);
if (now->next!=0) printf("%s\n",now->inf);
}
int main()
{
void down(struct stu *now);
struct stu *head,*now,*neww;
head=(struct stu*) malloc(sizeof(struct stu));
head->next=0;
gets(head->inf);
now=head;
do
{
neww=(struct stu*) malloc(sizeof(struct stu));
neww->next=0;
gets(neww->inf);
now->next=neww;
now=neww;
// printf("%s\n",now->inf);
}while (strcmp(now->inf,"end")!=0);
down(head);
// int i;scanf("%d",&i);
return 0;
}
|
31
|
15370
|
struct student
{
char id[10];
char name[20];
char sex[2];
int age;
char s[10];
char add[20];
struct student *next;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
int i=0;
p1=p2=(struct student*)malloc(LEN);
head=NULL;
while(scanf("%s",p1->id)&&*p1->id>=48&&*p1->id<=57)
{
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->s,p1->add);
if(i==0)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
i++;
}
p2->next=NULL;
return (head);
}
void turn(struct student *head)
{
struct student *p1,*p2;
p2=p1=head;
while(head->next!=NULL)
{
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
printf("%s %s %s %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->s,p1->add);
p2->next=NULL;p1=head;
}
printf("%s %s %s %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->s,p1->add);
}
void main()
{
struct student *head;
head=creat();
turn(head);
}
|
31
|
15371
|
struct stu
{
char x[300];
struct stu *next;
};
void creat1(struct stu *head,char *p) //?????
{
struct stu *pre,*p1,*s;
s=(struct stu *)malloc(sizeof(struct stu));
strcpy(s->x,p);
pre=head;
p1=pre->next;
pre->next=s;
s->next=p1;
}
void creat2(struct stu *head,char *p) //?????
{
struct stu *pre,*p1,*s;
s=(struct stu *)malloc(sizeof(struct stu));
strcpy(s->x,p);
pre=head;
p1=pre->next;
for(;p1!=NULL;)
{
pre=p1;
p1=p1->next;
}
pre->next=s;
s->next=p1;
}
int main()
{
int i,j,k,m,n;
char *p;
p=(char *)malloc(300*sizeof(int));
struct stu *head,*s;
head=(struct stu *)malloc(sizeof(struct stu));
head->next=NULL;
for(i=0;;i++)
{
gets(p);
if(*(p+0)=='e')
{
break;
}
else
{
creat1(head,p);
}
}
s=head->next;
for(;s!=NULL;)
{
puts(s->x);
s=s->next;
}
return 0;
}
|
31
|
15372
|
main()
{
char s[1000][1000];
int i=0,n=0;
while(1)
{
gets(s[n]);
if(s[n][0]=='e')
break;
else
n++;
}
for(i=n-1;i>=0;i--)
{puts(s[i]);printf("\n");}
}
|
31
|
15373
|
// ??????????.cpp : ??????????????
//
struct student
{
char info[100];
struct student *pre;
};
struct student *creat()
{
struct student *p1,*p2,*head;
p1=(struct student*)malloc(L);
gets(p1->info);
if(strcmp(p1->info,"end")==0)
{
return(NULL);
exit;
}
else
{
p2=NULL;
for(int i=1;;i++)
{
p1->pre=p2;
p2=p1;
p1=(struct student*)malloc(L);
gets(p1->info);
if(strcmp(p1->info,"end")==0) break;
}
p1->pre=p2;
head=p1->pre;
return(head);
}
}
int main()
{
struct student *p;
p=creat();
while(p!=NULL)
{
printf("%s\n",p->info);
p=p->pre;
};
return 0;
}
|
31
|
15374
|
struct student
{
char num[10];
char name[30];
char sex[2];
char age[5];
char score[10];
char add[20];
struct student *prev;
};
struct student *create(void)
{
struct student *p1,*p2;
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->num);
if(strcmp(p1->num,"end"))
{
scanf("%s%s%s%s%s",p1->name,p1->sex,p1->age,p1->score,p1->add);
p2=p1;
p1->prev=NULL;
}
while(strcmp(p1->num,"end"))
{
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->num);
if(strcmp(p1->num,"end"))
{
scanf("%s%s%s%s%s",p1->name,p1->sex,p1->age,p1->score,p1->add);
p1->prev=p2;
p2=p1;
}
}
return(p2);
}
void main()
{
struct student *p1;
p1=create();
while(p1!=NULL)
{
printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->prev;
}
}
|
31
|
15375
|
struct student
{
char num[200];
struct student *next;
};
void main()
{
int n,i,k,j;
struct student *head;
struct student *p1,*p2;
struct student *newhead,*nnew;
n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
gets(p1->num);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{
n=n+1;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->num);
}
p2->next=NULL;
for(i=0;i<n;i++)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(i==0)
newhead=nnew=p1;
else
nnew=nnew->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<n;i++)
{
printf("%s",p1->num);
p1=p1->next;
printf("\n");
}
}
|
31
|
15376
|
struct stu
{
char information[100];//????????????????????????????
struct stu*next;//??????
struct stu*last;//??????????????????????????
};
struct stu*creat(void)
{ struct stu *end,*p1,*p2;
int flag=1;
p1=(struct stu*)malloc(Len);
gets(p1->information);
if(strcmp(p1->information,"end")==0) //??????????????
{ p2=null; flag=0;}
else
{
p1->last=null;//?????????????
do
{
p2=p1;
p1=(struct stu*)malloc(Len);
p2->next=p1; //????????????
p1->last=p2;//?????????????????
gets(p1->information);
if(strcmp(p1->information,"end")==0) flag=0;//??end???????
}while(flag==1);
}
end=p2;
return end;
}
void printf(struct stu*end)
{
struct stu* p;
p=end;
while(p!=null)
{
printf("%s\n",p->information);
p=p->last;//???????????
}
}
int main()
{
struct stu *move;
move=creat();
printf(move);
}
|
31
|
15377
|
struct student{
char info[100];
struct student *before;
}student[10000];
int main()
{
void print(struct student *p);
int i=0,j;
char a[10000][100];
gets(a[0]);
while(a[i][0]!='e'){
strcpy(student[i].info,a[i]);
i++;
gets(a[i]);
}
student[0].before=NULL;
for(j=0;j<=i-1;j++){
student[j+1].before=&student[j];
}
print(&student[i-1]);
return 0;
}
void print(struct student *p)
{
printf("%s\n", p->info);
if(p->before!=NULL){print(p->before);}
}
|
31
|
15378
|
//???
int main()
{
struct student
{
char id[200];
char name[200];
char sex;
int age;
double score;
char add[200];
}stu[1000];
int i=0;
while(cin>>stu[i].id)
{
if(strcmp(stu[i].id,"end")==0)
break;
else
cin>>stu[i].name>>stu[i].sex>>stu[i].age>>stu[i].score>>stu[i].add;
i++;
}
int j=i;
for(j=i-1;j>=0;j--)
{
cout<<stu[j].id<<' '<<stu[j].name<<' '<<stu[j].sex<<' '<<stu[j].age<<' '<<stu[j].score<<' '<<stu[j].add<<endl;
}
return 0;
}
|
31
|
15379
|
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
|
15380
|
struct student
{
char num[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct student *next;
};
struct student *creat()
{
struct student *head,*p1,*p2;
p1 = (struct student*)malloc(len);
p2 = p1;
scanf("%s",p1->num);
if(strcmp(p1->num,"end") == 0)
{head = p1;p1->next = NULL;}
else
{
scanf(wtf);
p1->next = NULL;
for (;;)
{
p1 = (struct student*)malloc(len);
scanf("%s",p1->num);
if(strcmp(p1->num,"end") == 0)
break;
scanf(wtf);
p1->next = p2;
p2 = p1;
}
head = p2;
}
return(head);
}
main()
{
struct student *p;
p = creat();
if (p->next == NULL)
printf("\n");
else
{
for(;p!=NULL;)
{
printf(wtf2);
p = p->next;
}
}
}
|
31
|
15381
|
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
|
15382
|
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
|
15383
|
struct stu{
char num[20];
char name[20];
char gender;
int age;
float score;
char address[20];
struct stu *next;
};
struct stu *creat()
{
struct stu *head,*p1,*p2;
head=p1=p2=(struct stu *)malloc(LEN);
head->next=NULL;
scanf("%s",p1->num);
SCAN;
for(;;)
{
p1=(struct stu *)malloc(LEN);
scanf("%s",p1->num);
if(p1->num[0]!='e')
{SCAN;
p1->next=p2;
p2=p1;}
else
{break;}
}
return(p2);
}
int main()
{
struct stu *p,*t;
t=creat();
for(p=t;p!=NULL;p=p->next)
printf("%s %s %c %d %g %s\n",p->num,p->name,p->gender,p->age,p->score,p->address);
}
|
31
|
15384
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
float grade;
char addr[100];
struct student *next;
};
struct student *creat()
{
struct student *pt,*pn;
pn=(struct student *)malloc(sizeof(struct student));
pt=0;
scanf("%s",pn->num);
pn->next=0;
while(pn->num[0]!='e')
{
scanf("%s %c %d %f %s",pn->name,&pn->sex,&pn->age,&pn->grade,pn->addr);
pt=pn;
pn=(struct student *)malloc(sizeof(struct student));
pn->next=pt;
scanf("%s",pn->num);
}
return(pt);
}
int main()
{
struct student *head,*p;
head=creat();
p=head;
while(p!=0)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->addr);
p=p->next;
}
return 0;
}
|
31
|
15385
|
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
|
15386
|
struct stu
{
char a[1000];
struct stu *next;
};
void main()
{
struct stu *head,*p1,*p2;
p1=p2=(struct stu*)malloc(LEN);
head=p1;
p1->next=NULL;
gets(p1->a);
while (strcmp(p1->a,"end")!=0)
{
p1=(struct stu*)malloc(LEN);
gets(p1->a);
head=p1;
p1->next=p2;
p2=p1;
}
p1=head->next;
while (p1!=NULL)
{
puts(p1->a);
p1=p1->next;
}
}
|
31
|
15387
|
typedef struct student
{
char num[20];
char name[20];
char sex[2];
char age[3];
char mark[10];
char add[30];
struct student *next;
} stu;
int n;
stu* rcreate()
{
stu *head,*p;
head=p=(stu*)malloc(LEN);
scanf("%s",p->num);
p->next=NULL;
if(strcmp(p->num,"end")==0)
{
head=NULL;
return(NULL);
}
while(strcmp(p->num,"end")!=0)
{
scanf("%s %s %s %s %s",p->name,p->sex,p->age,p->mark,p->add);
p=(stu*)malloc(LEN);
p->next=head;
head=p;
scanf("%s",p->num);
}
head=p->next;
free(p);
return(head);
}
void print(stu* head)
{
stu *p;
p=head;
if(p==NULL)
{
printf("list null!");
return;
}
while(p->next!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
p=p->next;
}
printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
}
void main()
{
stu *h;
h=rcreate();
print(h);
}
|
31
|
15388
|
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
|
15389
|
struct S
{
char xuehao[200];
char xingming[200];
char xingbie;
int nianling;
float defen;
char dizhi[200];
struct S *next;
};
int main()
{
struct S *p1,*p2,*head;
head=(struct S *)malloc(sizeof(struct S));
p1=head;
scanf("%s",p1->xuehao);
head->next=NULL;
while(p1->xuehao[0]!='e')
{
scanf("%s %c%d%f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->defen,p1->dizhi);
p2=(struct S*)malloc(sizeof(struct S));
p2->next=p1;
p1=p2;
scanf("%s",p1->xuehao);
}
while(p1->next!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->next->xuehao,p1->next->xingming,p1->next->xingbie,p1->next->nianling,p1->next->defen,p1->next->dizhi);
p1=p1->next;
}
return 0;
}
|
31
|
15390
|
/*
* 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
|
15391
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char add[15];
struct student *next;
};
void main()
{
struct student *p1,*p2,*head;
int n=0;
p1=p2=(struct student*)malloc(LEN);
p1->next=NULL;
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
scanf("%s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
n++;
p2=(struct student*)malloc(LEN);
p2->next=p1;
p1=p2;
scanf("%s",p1->num);
}
head=p1->next;
p1=head;
while(p1->next!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}
|
31
|
15392
|
struct student
{
char con[50];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p,*q;
n=0;
p=q=(struct student *)malloc(len);
gets(p->con);
head=null;
while(strcmp(p->con,"end")!=0)
{
//scanf("%s %c %d %d %s",p->name,&p->gender,&p->age,&p->score,p->add);
n++;
if(n==1)head=p,p->next=null;
else head=p,p->next=q;
q=p;
p=(struct student *)malloc(len);
gets(p->con);
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
int i;
for(i=0;i<n;i++)
{
printf("%s\n",p->con);
p=p->next;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15393
|
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
|
15394
|
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);
curent=curent->p;
}
}
|
31
|
15395
|
struct student
{
char num[20];
char name[20];
char ch[1];
int ye;char gra[10];char add[20];
struct student *next;
};
int main()
{
struct student *p,*p1,*p2;
int n;
p1=p2=(struct student*) malloc(LEN);
scanf("%s",&p1->num);
p=NULL;n=0;
while (p1->num[0]!='e')
{
scanf("%s%s%d%s%s",&p1->name,&p1->ch,&p1->ye,&p1->gra,&p1->add);
n++;if (n==1) p2=p1;
else p1->next=p2;
p=p1;p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",&p1->num);
}
if (p!=NULL)
do
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->ch,p->ye,p->gra,p->add);
p=p->next;
}while (p!=NULL);
}
|
31
|
15396
|
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
|
15397
|
struct st
{
char id[200];
struct st *pre;
struct st *next;
} *p1, *p2;
int main(void)
{
p1 = p2 = (struct st*)malloc(LEN);
p1->pre = NULL;
gets(p1->id);
while(strcmp(p1->id,"end"))
{
p2->next=p1;
p2=p1;
p1=(struct st*)malloc(LEN);
gets(p1->id);
p1->pre=p2;
}
while(p2!=NULL)
{
printf("%s\n",p2->id);
p2 = p2->pre;
}
return 0;
}
|
31
|
15398
|
struct student
{
char num[10];
char qita[50];
struct student *last;
};
void main()
{
int l;
struct student *end,*head,*p1,*p2;
l=sizeof(struct student);
end=(struct student*)malloc(l);
head=(struct student*)malloc(l);
scanf("%s",head->num);
gets(head->qita);
head->last=end;
end->last=NULL;
p1=head;
p2=head;
for(;;)
{
p1=(struct student*)malloc(l);
scanf("%s",p1->num);
if(p1->num[0]=='e')
break;
gets(p1->qita);
p1->last=p2;
p2=p1;
}
while(p2->last!=NULL)
{
printf("%s%s\n",p2->num,p2->qita);
p2=p2->last;
}
}
|
31
|
15399
|
struct student
{
char num[30];
char name[50];
char sex;
int age;
float score;
char addr[100];
struct student *next;
struct student *pre;
};
int n;
struct student *end;
struct student *creat()
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr);
head=0;
p1->pre=0;
for(;strcmp(p1->num,"end")!=0;)
{
n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
p1->pre=p2;
scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr);
}
p2->next=0;
end=p2;
return head;
}
void backprint(struct student *head,struct student *end)
{
struct student *p;
p=end;
if(n==0)
printf("1\n");
else
if(end!=0)
for(;p!=0;)
{
printf("%s %s %c %d %g %s",p->num,p->name,p->sex,p->age,p->score,p->addr);
printf("\n");
p=p->pre;
}
}
void main()
{
struct student *head;
head=creat();
backprint(head,end);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.