label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
|---|---|---|
31
|
15000
|
struct Stu
{
char stu[100];
struct Stu *link;
};
int main()
{
struct Stu *p1,*p2;
p2=p1=(struct Stu *)malloc(LEN);
gets(p1->stu);
p1->link=NULL;
for(;;)
{
p2=p1;
p1=(struct Stu *)malloc(LEN);
gets(p1->stu);
p1->link=p2;
if(strcmp(p1->stu,"end")==0) break;
}
for(;;)
{
puts(p2->stu);
p2=p2->link;
if(p2==NULL) break;
}
return 0;
}
|
31
|
15001
|
int n;
struct student
{
char num[10];
char name[20];
char sex[2];
int year;
int score[10];
char add[10];
struct student *next;
};
struct student *creat()
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf("%s %s %s %d %s %s",p1->num,p1->name,p1->sex,&p1->year,p1->score,p1->add);
p1->next=NULL;
n=1;
head=p1;
p2=p1;
do
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)break;
scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->year,p1->score,p1->add);
p1->next=NULL;
p2->next=p1;
p2=p1;
n=n+1;
}while(1);
return(head);
}
void main()
{
struct student *head,*p,*q;
head=creat();
while(n!=0)
{
for(p=head;p->next!=NULL;)
{
q=p;
p=p->next;
}
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add);
n=n-1;
q->next=NULL;
}
}
|
31
|
15002
|
typedef struct node{
char id[100],name[100],sex[2],address[100],age[10],grade[10];
struct node *next;
}node;
node *head=NULL;
int create(){
node *p = (node*)malloc(sizeof(node));
scanf("%s",p->id);
if(p->id[0]=='e'){free(p);return 1;}
scanf("%s%s%s%s%s",p->name,p->sex,p->age,p->grade,p->address);
p->next = head;
head = p;
return 0;
}
void print(){
node *p = head,*temp;
for(;p!=NULL;){
printf("%s %s %s %s %s %s\n",p->id,p->name,p->sex,p->age,p->grade,p->address);
temp = p;
p = p->next;
free(temp);
}
}
int main()
{
int i,j,n,m,k;
for(;;){
if(create()==1)break;
}
print();
}
|
31
|
15003
|
struct student
{char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
struct student *next;
};
int main()
{
struct student *p;
struct student *p1,*p2;
p1=(struct student*)malloc(len);
(*p1).next=0;
scanf("%s",(*p1).num);
while((*p1).num[0]!='e'){
scanf("%s %c %d %s %s",(*p1).name,&(*p1).sex,&(*p1).age,(*p1).score,(*p1).add);
p2=p1;
p1=(struct student*)malloc(len);
(*p1).next=p2;
scanf("%s",(*p1).num);
}
p=p2;
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;
}
return 0;
}
|
31
|
15004
|
int main()
{
int n=0;
struct student
{
char num[20];
char name[20];
char sex[5];
int age;
char score[10];
char add[100];
struct student *next;
}*p1,*head,*p2,*end,*p3,*heade;
head=NULL;
p2=p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(p1->num[0]!='e')
{
head=p1;
scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->age,p1->score,p1->add);
n=1;
}
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->age,p1->score,p1->add);
n++;
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
}
p2->next=NULL;
end=p2;
if(n==1)
printf("%s %s %s %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
else if(n==2)
{
printf("%s %s %s %d %s %s\n",end->num,end->name,end->sex,end->age,end->score,end->add);
printf("%s %s %s %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
}
else
{
p1=head;
p2=head->next;
p3=p2->next;
p1->next=NULL;
p2->next=p1;
while(p3->next!=NULL)
{
p1=p2;
p2=p3;
p3=p2->next;
p2->next=p1;
}
p3->next=p2;
heade=p3;
p1=heade;
while(p1!=NULL)
{
printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
}
return 0;
}
|
31
|
15005
|
struct stu
{char num[50];
struct stu * next;
};
void main()
{
struct stu * head,*p1,*p2;
int i=1;
p1=p2=(struct stu *)malloc(L);
gets(p1->num);
head=p1;
while((strcmp(p1->num,"end")!=0))
{
p1=(struct stu*) malloc(L);
gets(p1->num);
p2->next=p1;
p2=p1;i++;
}
p2->next=0;
int k;
for(;i>1;i--)
{
k=i;
for(p1=head;k>2;k--)
{p1=p1->next;}
printf("%s\n",p1->num);
}
}
|
31
|
15006
|
struct stud
{
char num[30];
char name[20];
char sex;
int age;
char score[10];
char address[30];
struct stud *next;
};
int main()
{
struct stud *head,*p1,*p2,*p;
int n=0;
p1=p2=(struct stud *)malloc(sizeof(struct stud));
scanf("%s",&p1->num);
if (strcmp(p1->num,"end")==0) return 0;
scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
head=Null;
while(1)
{
n++;
if (n==1) p1->next=Null;
else p1->next=p2;
p2=p1;
p1=(struct stud *)malloc(sizeof(struct stud));
scanf("%s",&p1->num);
if (strcmp(p1->num,"end")==0) break;
scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
}
head=p2;
p=head;
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}while(p!=Null);
return 0;
}
|
31
|
15007
|
struct student
{
char num[10];
char name[20];
char sex[2];
int age;
float score;
char address[40];
struct student *next;
};
void main()
{
struct student *p,*p1,*p2;
p1=(struct student *)malloc(len);
p1->next=NULL;
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->address);
p2=p1;
p1=(struct student*)malloc(len);
p1->next=p2;
scanf("%s",p1->num);
}
if(p2->next!=NULL){
for(p=p2;p->next!=NULL;p=p->next)
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
}
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
}
if(p2->next=NULL)
printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address);
}
|
31
|
15008
|
struct student
{
char num[20];
char name[20];
char sex[2];
int age;
float score;
char add[100];
struct student *next;
};
int main()
{
struct student *p1,*p2,*head;
p1=(struct student*)malloc(sizeof(struct student));
p1->next=NULL;
scanf("%s",p1->num);
if (p1->num[0]!='e')
{
while (p1->num[0]!='e')
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
p2=p1;
p1=(struct student*)malloc(sizeof(struct student));
p1->next=p2;
scanf("%s",p1->num);
}
head=p2;
while (head!=NULL)
{
printf("%s %s %s %d %g %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
head=head->next;
}
}
return 0;
}
|
31
|
15009
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
float score;
char address[1000];
struct student *next;
}stu[10000];
int main()
{
struct student *head,*p;
int i,j;
char str[4]="end";
for(i=0;;i++)
{
scanf("%s",stu[i].num);
if(strcmp(stu[i].num,str)==0)
break;
scanf("%s",&stu[i].name);
scanf(" %c",&stu[i].sex);
scanf("%d",&stu[i].age);
scanf("%f",&stu[i].score);
scanf("%s",&stu[i].address);
}
stu[0].next=NULL;
for(j=1;j<i;j++)
stu[j].next=&stu[j-1];
head=&stu[i-1];
if (i>0)
for(p=head;p!=NULL;p=p->next)
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
return 0;
}
|
31
|
15010
|
struct student
{
char num[100];
struct student *prev;
};
main()
{
struct student *p1,*p2;
int flag=0;
while (1)
{
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->num);
if (*(p1->num)=='e') break;
else
{
if (flag==0)
{
p2=p1;
p1->prev=NULL;
flag=1;
}
else
{
p1->prev=p2;
p2=p1;
}
}
}
while (p2!=NULL)
{
printf("%s\n",p2->num);
p2=p2->prev;
}
return 0;
}
|
31
|
15011
|
struct student
{
char id[50];
char s[50];
char sex;
int age;
char score[10];
char add[20];
struct student *po;
};
int main()
{
struct student *p,*q;
q=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",q->id,q->s,&q->sex,&q->age,q->score,q->add);
q->po=NULL;
p=q;
q=(struct student*)malloc(LEN);
scanf("%s",q->id);
while(strcmp(q->id,"end")!=0)
{
scanf("%s %c %d %s %s",q->s,&q->sex,&q->age,q->score,q->add);
q->po=p;
p=q;
q=(struct student*)malloc(LEN);
scanf("%s",q->id);
}
printf("%s %s %c %d %s %s\n",p->id,p->s,p->sex,p->age,p->score,p->add);
while(p->po!=NULL)
{
p=p->po;
printf("%s %s %c %d %s %s\n",p->id,p->s,p->sex,p->age,p->score,p->add);
}
return 0;
}
|
31
|
15012
|
int n;
struct student
{
char s[100];
struct student *next;
};
void main()
{
struct student *head, *p1, *p2; n=0;
p1=p2=( struct student*) malloc(LEN);
gets(p1->s);
head=NULL;
while(p1->s[0]!='e')
{
n=n+1;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->s);
}
head=p2;
p1=head;
while(p1!=NULL)
{
printf("%s\n",p1->s);
p1=p1->next;
}
}
|
31
|
15013
|
struct Student
{
char r[200];
struct Student *next,*up;
};
int main()
{
struct Student *p,*h,*pre;
h=NULL;
while (1)
{
p=malloc(L);
if (h==NULL)
{
h=p;
p->up=h;
}
else
{
pre->next=p;
p->up=pre;
}
gets(p->r);
if (strcmp(p->r,"end")==0) break;
//scanf("\n");
pre=p;
}
p=pre;
while (1)
{
printf("%s",p->r);
if (p==h) break;
else printf("\n");
p=p->up;
}
return 0;
}
|
31
|
15014
|
struct student{
char num[50];
char name[50];
char sex[50];
char age[50];
char score[50];
char adr[50];
struct student *next;
};//?????????????
int main(){
struct student *p1,*p2,*head;
p1=(struct student *)malloc(LEN);
int i=0;
p2=NULL;
for(;;i++)
{
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{//??p1->num?????
break;
}
scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1->next=p2;
p2=p1;
}
head=p2;
if(head!=NULL)
{
p1=head;
do{
printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1=p1->next;
}while(p1!=NULL);
}
return 0;
}
|
31
|
15015
|
struct stu
{
char xinxi[100];
struct stu *next;
};
void main()
{
int len=1,i;
struct stu *p1,*p2,*head,*new1,*newhead;
p1=p2=head=(struct stu *)malloc(sizeof(struct stu));
gets(p1->xinxi);
while(strcmp(p1->xinxi,"end")!=0)
{
p1=(struct stu *)malloc(sizeof(struct stu));
gets(p1->xinxi);
if(strcmp(p1->xinxi,"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!='\0')
{
p2=p1;
p1=p1->next;
}
if(i==0)
{
newhead=new1=p1;
}
else
{
new1=new1->next=p1;
}
p2->next=NULL;
}
p1=newhead;
for(i=0;i<len;i++)
{
printf("%s\n",p1->xinxi);
p1=p1->next;
}
}
|
31
|
15016
|
int main()
{
struct student
{
char a[20];
char b[20];
char c[20];
char d[20];
char e[20];
char f[20];
struct student *pNext;
};
struct student *pHeader = (struct student *)malloc(sizeof(struct student));
pHeader->pNext=NULL;
struct student *p;
while(1)
{
p=(struct student *)malloc(sizeof(struct student));
p->pNext=pHeader->pNext;
pHeader->pNext=p;
scanf("%s",p->a);
if(p->a[0]=='e') break;
scanf("%s %s %s %s %s",p->b,p->c,p->d,p->e,p->f);
}
p=pHeader->pNext->pNext;
while(1)
{
if(p==NULL) break;
printf("%s %s %s %s %s %s\n",p->a,p->b,p->c,p->d,p->e,p->f);
p=p->pNext;
}
}
|
31
|
15017
|
struct stu
{
char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
struct stu *next;
};
int main()
{
struct stu *p1,*p2,*head;
p1=(struct stu*)malloc(sizeof(struct stu));
p1->next=NULL;
p2=p1;
p1=(struct stu*)malloc(sizeof(struct stu));
while(1)
{
scanf("%s",p1->num);
if(p1->num[0]=='e')
{
head=p2;
p1->next=p2;
break;
}
scanf("%s %c %d %s %s",p1->name,&(p1->sex),&(p1->age),p1->score,p1->add);
p1->next=p2;
p2=p1;
p1=(struct stu*)malloc(sizeof(struct stu));
}
p1=head;
while(p1->next!=NULL)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
}
return 0;
}
|
31
|
15018
|
main()
{
int i,j,k,n,m;
struct student
{
char num[200];
char name[200];
char sex;
int age;
char score[20];
char add[500];
}stu[1000];
i=0;
while(1)
{
scanf("%s",stu[i].num);
if(strcmp(stu[i].num,"end")==0)
break;
scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
i++;
}
for(j=i-1;j>=0;j--)
{
printf("%s %s %c %d %s %s\n",stu[j].num,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add);
}
}
|
31
|
15019
|
struct L
{
char a[6][20];
struct L *pq;
struct L *ph;
};
struct L *creat(void)
{
struct L *p1,*p2,*p3,*head,*end;
int i,j,k,l;
l=sizeof(struct L);
p1=head=(struct L *)malloc(l);
p1->pq=NULL;
do
{
for(i=0;i<6;i++)
scanf("%s",p1->a[i]);
p2=(struct L *)malloc(l);
p3=p2->pq=p1;
p1->ph=p2;
p1=p2;
}while(p3->a[0][0]!='e');
return p3->pq;
}
int main()
{struct L *creat(void);
int i,j;
struct L *head,*p1,*p2;
p1=head=creat();
do
{for(i=0;i<6;i++)
{if(i==0) printf("%s",p1->a[0]);
else printf(" %s",p1->a[i]);}
printf("\n");
p1=p1->pq;
}while(p1!=NULL);
}
|
31
|
15020
|
struct student
{
char id[10];
char name[100];
char sex;
int age;
char score[100];
char adr[100];
struct student *next;
};
int n=0;
struct student *creat()
{
struct student *head,*p1,*p2;
head=NULL;
p1=p2=(struct student*)malloc(LEN);
scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr);
while(p1->id[0]!='e')
{
n++;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr);
}
p2->next=NULL;
return(head);
}
void print(struct student*head,int m)
{
struct student*p1;
p1=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->adr);
p1=p1->next;
}while(p1!=NULL);
}
struct student *turnback(struct student *head)
{
struct student *p1,*p2,*news,*p;
int i;
for(i=n;i>=0;i--)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;p1=p1->next;
}
if(i==n)
p=news=p1;
else
{
p=p->next=p1;
p2->next=NULL;
}
}
return(news);
}
int main()
{
struct student*head,*newhead;
head=creat();
newhead=turnback(head);
print(newhead,n);
}
|
31
|
15021
|
struct student
{
char num[30];
char name[30];
char s;
float grad1;
float grad2;
char add[30];
struct student *next,*prev;
};
void main()
{
struct student *head,*temp,*end;
head=(struct student *)malloc(sizeof(struct student));
temp=head;
head->prev=0;
while(1)
{
scanf("%s",temp->num);
if(strcmp(temp->num,"end")==0)
break;
scanf("%s %c %f %f %s",temp->name,&temp->s,&temp->grad1 ,&temp->grad2,temp->add );
temp->next=(struct student *)malloc(sizeof(struct student));
temp->next->prev =temp;
temp=temp->next;
}
end=temp->prev;
end->next=0;
temp=end;
while(temp!=0)
{
printf("%s %s %c %g %g %s\n",temp->num ,temp->name,temp->s,temp->grad1 ,temp->grad2,temp->add );
temp=temp->prev;
}
}
|
31
|
15022
|
struct student
{
struct student *pre;
char mess[500];
};
void main()
{
int n=0;
struct student *p1,*p2,*p;
p1=(struct student *)malloc(LEN);
while(strcmp(gets(p1->mess),"end")!=0)
{
n=n+1;
if(n==1)
p1->pre=NULL;
else
p1->pre=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
}
p=p2;
do
{
printf("%s\n",p->mess);
p=p->pre;
}while(p!=NULL);
}
|
31
|
15023
|
struct stu
{
char inf[50];
struct stu *next;
};
struct stu *head,*p1,*p2;
int output(struct stu *point);
int main()
{
p1=(struct stu *)malloc(sizeof(struct stu));
head=p1;
while(gets((*p1).inf)!=NULL)
{
p2=(struct stu *)malloc(sizeof(struct stu));
(*p1).next=p2;
p1=p2;
}
(*p1).next=NULL;
output(head);
return 0;
}
int output(struct stu *point)
{
if(strcmp(point->next->inf,"end")!=0)
output(point->next);
puts((*point).inf);
return 0;
}
|
31
|
15024
|
struct student
{
char num[50];
char name[50];
char sex[1];
int age;
float score;
char address[50];
struct student *next;
};
void main()
{
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(sizeof(struct student));
head=p1;
scanf("%s%s%s%d%f%s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
p2->next=NULL;
while(strcmp(p1->num,"end")!=0)
{
p1=(struct student*)malloc(sizeof(struct student));
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0) break;
scanf("%s%s%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
p2=p1;
p2->next=head;
head=p1;
}
p2=head;
while(p2!=NULL)
{
printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address);
p2=p2->next;
}
}
|
31
|
15025
|
struct student
{
char str[1000];
struct student *next;
};
void main()
{
struct student a[1000],*p,*head;
int i,j,t;
for(i=0;;i++)
{
gets(a[i].str);
if(a[i].str[0]=='e')
break;
}
for(j=i-1;j>=0;j--)
{
head=&a[i-1]; /*???a[i-1]???a[i]????????*/
a[j].next=&a[j-1]; /*????????end*/
a[0].next=NULL;
}
p=head;
do
{
printf("%s\n",p->str);
p=p->next ;
} while(p!=NULL);
}
|
31
|
15026
|
main()
{
struct inf
{
struct inf *pLate;
char num[20];
char nam[20];
char gen;
int old[20];
int sco[20];
char loc[20];
struct inf *pNext;
};
int i,j,k;
struct inf *pHeader;
pHeader=(struct inf *)malloc(sizeof(struct inf));
struct inf *p;
struct inf *p1=NULL;
p=pHeader;
pHeader->pLate=NULL;
for(i=0;;i++)
{
p->pNext=(struct inf *)malloc(sizeof(struct inf));
p=p->pNext;
p->pLate=p1;
scanf("%s",p->num);
if(p->num[0]=='e')
{
p->pNext=NULL;
break;
}
else
{
scanf("%s %c %s %s %s",p->nam,&p->gen,p->old,p->sco,p->loc);
p1=p;
}
}
for(j=i;j>=1;j--)
{
p=p->pLate;
printf("%s %s %c %s %s %s\n",p->num,p->nam,p->gen,p->old,p->sco,p->loc);
}
p=pHeader;
struct inf *pd;
for(k=0;k<=i;k++)
{
pd=p;
p=p->pNext;
free(pd);
}
free(p);
}
|
31
|
15027
|
struct stud
{
char num[20];
char name[20];
char sex;
int age;
char grade[10];
char add[30];
struct stud *next;
};
struct stud *creat(void)
{
struct stud *head,*p1,*p2;
p1=p2=(struct stud *)malloc(sizeof(struct stud));
p2->next=0;
head=p1;
for(;;)
{
scanf("%s",p1->num);
if(*(p1->num+2)=='d')
return head;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
p1=(struct stud *)malloc(sizeof(struct stud));
head=p2;
p1->next=p2;
p2=p1;
}
}
void print(struct stud *head)
{
struct stud *p;
for(p=head;p!=0;p=p->next)
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add);
}
void main()
{
struct stud *head;
head=creat();
print(head);
}
|
31
|
15028
|
struct student
{
char id[100];
char name[100];
char sex;
int age;
char score[100];
char addr[100];
struct student *pre,*next;
};
void main()
{
struct student *p1,*p2,*head1,*head2;
int n=0;
char temp[100];
head1=NULL;
p1=p2=NULL;
while(scanf("%s",temp),strcmp(temp,"end")!=0)
{
n=n+1;
p1=(struct student *)malloc(sizeof(struct student));
p1->pre=NULL;
p1->next=NULL;
strcpy(p1->id,temp);
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
if(n==1)head1=p1;else {p2->next=p1;p1->pre=p2;}
p2=p1;
}
head2=p2;
while(p2!=NULL)
{
printf("%s %s %c %d %s %s\n",p2->id,p2->name,p2->sex,p2->age,p2->score,p2->addr);
p2=p2->pre;
}
}
|
31
|
15029
|
struct stu
{
char num[30];
char name[30];
char sex;
int age;
float score;
char add[30];
struct stu *next;
};
struct stu *p1,*p2,*head;
int main()
{
void result(struct stu*);
p1=p2=(struct stu*) malloc(sizeof(struct stu));
scanf("%s ",p1->num);
scanf("%s ",p1->name);
scanf("%c",&(p1->sex));
scanf("%d",&(p1->age));
scanf("%g",&(p1->score));
scanf("%s",p1->add);
head=p1;head->next=0;
for(;;)
{
p1=(struct stu*) malloc(sizeof(struct stu));
p2->next=p1;
scanf("%s",p1->num);
if(p1->num[0]=='e'&&p1->num[1]=='n'&&p1->num[2]=='d')
{p2->next=0;goto print;}
scanf("%s ",p1->name);
scanf("%c",&(p1->sex));
scanf("%d",&(p1->age));
scanf("%g",&(p1->score));
scanf("%s",p1->add);
p2=p1;
}
print:result(head);
return 0;
}
void result(struct stu *x)
{
if(x->next==0)
{printf("%s ",x->num);
printf("%s ",x->name);
printf("%c",x->sex);
printf(" %d",x->age);
printf(" %g",x->score);
printf(" %s",x->add);
printf("\n");
}
else
{
result(x->next);
printf("%s ",x->num);
printf("%s ",x->name);
printf("%c",x->sex);
printf(" %d",x->age);
printf(" %g",x->score);
printf(" %s",x->add);}
printf("\n");
}
|
31
|
15030
|
main()
{
char a[2000][20],b[2000][20],c[2000][20],d[2000][20],e[2000][20],s[2000][20];
int i=0,j;
scanf("%s",a[i]);
while(1)
{
scanf("%s",b[i]);
scanf("%s",c[i]);
scanf("%s",e[i]);
scanf("%s",s[i]);
scanf("%s",d[i]);
i++;
scanf("%s",a[i]);
if(a[i][0]=='e')
break;
}
for(j=i-1;j>=0;j--)
{
printf("%s %s %s %s %s %s\n",a[j],b[j],c[j],e[j],s[j],d[j]);
}
}
|
31
|
15031
|
int main()
{
struct student
{
char imfor[100];
};
int n=1,m;
struct student *p1,*p3[600];
p1=p3[0]=(struct student *)malloc(sizeof(struct student));
gets(p1->imfor);
while (p1->imfor[0]!='e')
{
p1=(struct student * )malloc(sizeof(struct student));
p3[n]=p1;
n++;
gets(p1->imfor);
}
for (m=n-2;m>=0;m--)
{
printf("%s\n",p3[m]->imfor);
}
}
|
31
|
15032
|
struct student{
struct student *pre;
char s[100];
struct student *next;
};
struct student *creat()
{
struct student *p1,*p2;
p1=(struct student*)malloc(len);
gets(p1->s);
p1->pre=NULL;
p1->next=NULL;
p2=p1;
while(strcmp(p1->s,"end"))
{
p1=(struct student*)malloc(len);
gets(p1->s);
p1->pre=p2;
p2->next=p1;
p1->next=NULL;
p2=p1;
}
return(p1->pre);
}
void print(struct student *end)
{
while(end)
{
puts(end->s);
end=end->pre;
}
}
void main()
{
struct student *end;
end=creat();
print(end);
}
|
31
|
15033
|
struct student
{
char stu[100];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p1,*p2,*toil;
n=0;
head=NULL;
p1=p2=(struct student*)malloc(LEN);
gets(p1->stu);
while(strcmp(p1->stu,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->stu);
}
toil=p2;
head->next=NULL;
return(toil);
}
void print(struct student *toil)
{
struct student *p;
p=toil;
if(toil!=NULL)
do
{
printf("%s\n",p->stu);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15034
|
void main()
{
char a[200];
gets(a);
if(a[0]-'e'||a[1]-'n'||a[2]-'d')
{
main();
puts(a);
}
}
|
31
|
15035
|
struct student
{
char ID[20];
char name[20];
char sex;
int age;
char score[20];
char address[20];
struct student *next;
};
struct student *create()
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;}
else
{
head=p1;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
p2=p1;
do
{
p1=(struct student*)malloc(LEN);
p1->next=NULL;
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){p2->next=NULL;free(p1);break;}
else
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p2->next=p1;
p1->next=NULL;
p2=p1;
}
}while(1);
}
return(head);
}
void print(struct student *list)
{
if(list==NULL)return;
else if(list->next==NULL)
printf("%s %s %c %d %s %s\n",list->ID,list->name,list->sex,list->age,list->score,list->address);
else
{
print(list->next);
printf("%s %s %c %d %s %s\n",list->ID,list->name,list->sex,list->age,list->score,list->address);
}
}
int main()
{
struct student *head;
head=create();
print(head);
}
|
31
|
15036
|
struct student
{
/*char id[20];
char name[10];
char sex;
int age;
int score;
char addr[20];*/
char s[100];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
//scanf("%s",p1->id);
gets(p1->s);
/*while(p1->s!="end")*/
while(strcmp(p1->s,"end")!=0)
{
//printf(p1->s);
//scanf("%s %c %d %d %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
n++;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
//scanf("%s",p1->id);
gets(p1->s);
}
//printf(p1->s);
head=p2;
//printf(p2->s);
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
//printf(p->s);
if(head!=NULL)
do
{
//printf("%s %s %c %d %d %s",p->id,p->name,p->sex,p->age,p->score,p->addr);
if (p->next != NULL)
{
printf(p->s);
printf("\n");
}
else
printf(p->s);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student*head;
head=creat();
print(head);
}
|
31
|
15037
|
struct Student
{
struct Student *previous;
char no[20];
char name[30];
char sex;
int age;
float score;
char address[30];
};
struct Student *creat()
{
struct Student *end,*p1,*p2;
p1=NULL;
for(;;)
{
p2=p1;
p1=(struct Student*)malloc(LEN);
p1->previous=p2;
scanf("%s",p1->no);
if(strcmp(p1->no,"end")==0)break;
else
{
scanf("%s",p1->name);
getchar();
p1->sex=getchar();
scanf("%d%f",&p1->age,&p1->score);
scanf("%s",p1->address);
}
}
end=p2;
return(end);
}
void print(struct Student *end)
{
struct Student *p;
p=end;
do
{
printf("%s %s %c %d %g %s\n",p->no,p->name,p->sex,p->age,p->score,p->address);
p=p->previous;
}while(p!=NULL);
}
void main()
{
struct Student *end;
end=creat();
print(end);
}
|
31
|
15038
|
struct student
{
char a[100];
struct student *pre;
};
struct student *creat()
{
struct student *p1;struct student *p2;
struct student *head;
head=(struct student *) malloc(sizeof(struct student));
p1=p2=head;
head->pre=0;
while(1)
{
p1=(struct student *)malloc(sizeof(struct student));
p1->pre=p2;
gets(p1->a);
if(p1->a[0]=='e')
{
return (p2);
}
p2=p1;
}
}
int main()
{
struct student *p1;
p1=creat();
while(p1->pre!=0)
{
printf("%s\n",p1->a);
p1=p1->pre;
}
return 0;
}
//?????????????????
|
31
|
15039
|
struct seqs//????
{
char num[10];
char name[20];
char sex;
int age;
float score;//???????
char addr[100];
struct seqs *next;
};
struct seqs *build()//????
{
struct seqs *head,*newnode,*p;
newnode=(struct seqs *)malloc(len); newnode->next=NULL;//????????
scanf("%s %s %c %d %f %s",newnode->num,newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->addr);//????????????
p=newnode;//???p?????????
while(1)//???????????????????
{
newnode=(struct seqs *)malloc(len);//?????
scanf("%s",newnode->num);
if(newnode->num[0]=='e')
break;//???????????
scanf("%s %c %d %f %s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->addr);//????
newnode->next=p;//??????????
p=newnode;//???p??????
}
head=p;//??head
return head;
}
void main()
{
int i;
struct seqs *p;
p=build();
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->next;
}
}
|
31
|
15040
|
int main(){
struct {
char No[100];
char name[20];
char sex;
int age;
float grade;
char address[20];
} stu[10000];
int i;
cin>>stu[0].No>>stu[0].name>>stu[0].sex>>stu[0].age>>stu[0].grade>>stu[0].address; //???????
for(i=1;stu[i-1].No[0]!='e';i++){
cin>>stu[i].No;
if(stu[i].No[0]!='e') //????end?????
cin>>stu[i].name>>stu[i].sex>>stu[i].age>>stu[i].grade>>stu[i].address;
}
for(i=i-2;i>=0;i--) //????
cout<<stu[i].No<<" "<<stu[i].name<<" "<<stu[i].sex<<" "<<stu[i].age<<" "<<stu[i].grade<<" "<<stu[i].address<<endl;
return 0;
}
|
31
|
15041
|
struct student
{
char num[200];
char name[100];
char xingbie;
int age;
char score[200];
char add[200];
struct student *next;
};
struct student*creat()
{
struct student *p1,*head;
p1=(struct student*)malloc(LEN);
head=NULL;
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0) return head;
scanf("%s %c %d %s %s",p1->name,&p1->xingbie,&p1->age,p1->score,p1->add);
while(1)
{
p1->next=head;
head=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
break;
else
scanf("%s %c %d %s %s",p1->name,&p1->xingbie,&p1->age,p1->score,p1->add);
}
return (head);
}
void main()
{
struct student *p;
p=creat();
while(p!=NULL)
{
if((strcmp(p->num,"end")==0)){p=p->next;continue;}
printf("%s %s %c %d %s %s\n",p->num,p->name,p->xingbie,p->age,p->score,p->add);
p=p->next;
};
}
|
31
|
15042
|
struct stu
{
char num[1000];
struct stu *pre;
}*phead,*p1,*p2,*pend;
void print(void)
{
struct stu *p;
for(p=pend;p!=phead;)
{
puts(p->num);
p=p->pre;
}
puts(p->num);
}
main()
{
for(p1=p2=phead=(struct stu*)malloc(sizeof(struct stu));;)
{
gets(p1->num);
if(p1->num[0]=='e')
{
pend=p1->pre;
break;
}
p1=(struct stu*)malloc(sizeof(struct stu));
p1->pre=p2;
p2=p1;
}
print();
}
|
31
|
15043
|
struct student
{
char number[20];
char name[20];
char sex[2];
int year;
float score;
char address[100];
struct student *next;
};
int main()
{
struct student *p1,*p2;
p1=(struct student *)malloc(sizeof(struct student));
p1->next=NULL;
scanf("%s",p1->number);
while(p1->number[0]!='e')
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->year,&p1->score,p1->address);
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
p1->next=p2;
scanf("%s",p1->number);
}
while(p2!=NULL)
{
printf("%s %s %s %d %g %s\n",p2->number,p2->name,p2->sex,p2->year,p2->score,p2->address);
p2=p2->next;
}
return 0;
}
|
31
|
15044
|
struct Student
{
char num[10];
char nam[20];
char sex[2];
char age[3];
char sco[6];
char add[12];
struct Student*next;
};
int n;
struct Student*creat(void)
{
struct Student*head;
struct Student*p;
p=(struct Student*)malloc(LEN);
head=NULL;n=0;
scanf("%s",p->num);
while(strcmp(p->num,"end")!=0)
{
n=n+1;
scanf("%s%s%s%s%s",p->nam,p->sex,p->age,p->sco,p->add);
if(n==1)head=p;
else
{
p->next=head;
head=p;
}
p=(struct Student*)malloc(LEN);
scanf("%s",p->num);
}
return(head);
}
int main()
{
struct Student*pt;
pt=creat();
while(pt!=NULL)
{
printf("%s %s %s %s %s %s\n",pt->num,pt->nam,pt->sex,pt->age,pt->sco,pt->add);
pt=pt->next;
}
return 0;
}
|
31
|
15045
|
struct student
{char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct student *nest;
struct student *front;
};
void main()
{
struct student *p1,*p2;
int n=0;
p1=p2=(struct student*)malloc(LEN);
p1->front=NULL;
scanf("%s",&p1->number);
while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
{
scanf("%s %c%d%s%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
n=n+1;
p2->nest=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
p1->front=p2;
scanf("%s",&p1->number);
}
p2->nest=NULL;
while(p2!=NULL)
{
printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address);
p2=p2->front;
}
}
|
31
|
15046
|
struct student{
char num[20],name[20],add[100],sex[2];
int age;
float score;
struct student *next;
};
void main()
{
struct student *p1,*p,*p2;
p=(struct student*)malloc(sizeof(struct student));
p->next=NULL;
scanf("%s",p->num);
while(p->num[0]!='e')
{
scanf("%s%s%d%f%s",p->name,p->sex,&p->age,&p->score,p->add);
p1=p;
p=(struct student*)malloc(sizeof(struct student));
p->next=p1;
scanf("%s",p->num);
}
p2=p1;
while(p2!=NULL)
{
printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->add);
p2=p2->next;
}
}
|
31
|
15047
|
struct student
{
char str[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(len);
gets(p1->str);
if(strcmp(p1->str,"end")==0)
{
free(p1);
head=NULL;
return head;
}
else
{
p1->next=NULL;
head=p1;
p2=p1;
do
{
p1=(struct student*)malloc(len);
gets(p1->str);
if(strcmp(p1->str,"end")==0)
{
free(p1);
break;
}
else
{
p1->next=NULL;
p1->next=p2;
p2=p1;
head=p1;
}
}
while(1);
return head;
}
}
int main()
{
struct student *p,*pa;
pa=creat();
p=pa;
do
{
printf("%s\n",p->str);
p=p->next;
}
while(p!=NULL);
return 0;
}
|
31
|
15048
|
struct student
{
char all[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p,*q;
int t=0;
head=(struct student*) malloc (sizeof (struct student));
gets(head->all);
q=head;
head->next=NULL;
do
{
if(t>0)
{
p->next=q;
q=p;
}
p=(struct student*) malloc (sizeof (struct student));
gets(p->all);
t++;
}while(strcmp(p->all,"end")!=0);
return(q);
}
void print(struct student *head)
{
struct student *p;
p=head;
do
{
printf("%s\n",p->all);
p=p->next;
}while (p!=NULL);
}
void main()
{
struct student *headnew;
headnew=creat();
print(headnew);
}
|
31
|
15049
|
struct student
{
char a[10];
char b[20];
char c;
int d;
float e;
char f[19];
struct student * next;
};
int main()
{
struct student *p1,*p2;
p1=(struct student *)malloc(len);
scanf("%s %s %c %d %f %s",p1->a,p1->b,&p1->c,&p1->d,&p1->e,p1->f);
p1->next=NULL;
p2=p1;
while(1)
{
p1=(struct student *)malloc(len);
scanf("%s",p1->a);
if(strcmp(p1->a,"end")==0)
break;
scanf("%s %c %d %f %s",p1->b,&p1->c,&p1->d,&p1->e,p1->f);
p1->next=p2;
p2=p1;
}
p1=p2;
while(p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
p1=p1->next;
}
return 0;
}
|
31
|
15050
|
typedef struct node
{
char s[100];
struct node *next;
}node;
int main()
{
node *p1,*p2,*head;
head=(node*)malloc(sizeof(node));
p1=head;
p2=head;
int i=0;
while(1)
{
p2=(node*)malloc(sizeof(node));
if(i==0)
p2->next=NULL;
else
p2->next=p1;
p1=p2;
gets(p2->s);
if(strcmp(p2->s,"end")==0)
break;
head->next=p2;
i=1;
}
p1=head->next;
while(p1!=NULL)
{
printf("%s\n",p1->s);
p1=p1->next;
}
return 0;
}
|
31
|
15051
|
struct student
{
char num[1000];
struct student *next;
};
int n=0;
struct student *creat()
{
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
gets(p1->num);
while (strcmp(p1->num,"end")!=0)
{
n=n+1;
if (n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->num);
}
p2->next=NULL;
return (head);
}
struct student *reverse(struct student *head)
{
struct student *s,*s1;
s=head;
head=NULL;
while(s)
{
s1=s;
s=s->next;
s1->next=head;
head=s1;
}
return (head);
}
void print (struct student *head)
{
struct student *p;
p=head;
while (p!=NULL)
{
printf("%s\n",p->num);
p=p->next;
}
}
void main ()
{
struct student *head;
head=creat();
head=reverse(head);
print(head);
}
|
31
|
15052
|
int n;
struct stu
{char num[10];
char name[20];
char sex;
int age;
float score;
char add[30];
struct stu *next;
};
struct stu *create()
{
struct stu *head, *p1,*p2;
n=1;
p1=(struct stu *)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 = p1;
p2 = p1;
do
{
p1=(struct stu *)malloc(LEN);
scanf("%s", &p1->num);
if (strcmp(p1->num,"end")==0)
{free(p1);break;}
else
{
scanf(" %s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
p1->next=NULL;
p2->next = p1;
p2 = p1;
n++;
}
}while (1);
return head;
}
struct stu *del(struct stu *head)
{
struct stu *p, *ppre;
p=head;
while (p&&p->next!=NULL)
{ ppre = p; p=p->next;}
printf("%s %s %c %d %g %s\n", p->num,p->name,p->sex,p->age,p->score,p->add);
ppre->next=NULL;
free(p);
return head;
}
void main()
{
struct stu *head;
int i;
head=create();
for(i=0;i<n;i++)
head=del(head);
}
|
31
|
15053
|
struct node
{
struct node *last;
char id[15];
char name[25];
char sex;
int age;
char score[10];
char addr[15];
struct node *next;
};
int n=1;
struct node *newnode()
{
struct node *head=NULL,*New,*This;
do
{
New=(struct node *)malloc(sizeof(struct node));
scanf("%s",New->id);
if(n==1)
{
head=New;
New->last=NULL;
This=head;
}
else
{
This->next=New;
New->last=This;
}
if(strcmp(New->id,"end")!=0)
{
scanf("%s %c %d %s %s",New->name,&New->sex,&New->age,New->score,New->addr);
This=New;
n++;
}
}while(strcmp(New->id,"end")!=0);
This->next=NULL;
return(This);
}
void main()
{
struct node *p;
p=newnode();
do
{
printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->addr);
p=p->last;
}while(p->last!=NULL);
printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->addr);
}
|
31
|
15054
|
struct Student
{
char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
struct Student *next;
};
struct Student *creat()
{
int i;
struct Student *head,*p1,*p2;
p1=(struct Student *)malloc(LEN);
scanf("%s",p1->num);
for(i=0;p1->num[0]!='e';i++)
{
head=p1;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
if(i==0) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct Student *)malloc(LEN);
scanf("%s",p1->num);
}
return head;
}
int main()
{
struct Student *head,*p;
head=creat();
p=head;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}
return 0;
}
|
31
|
15055
|
//#define LEN sizeof(struct student)
struct student
{
char num[50];
struct student * next;
};
int n;
char end[4]="end";
struct student * creat(void)
{
struct student * p1,*p2;
n=0;
p1=p2=(struct student*)malloc(sizeof(struct student));//
gets(p1->num);
while(strcmp(end,p1->num)!=0)//
{
n=n+1;
if(n==1)
p2->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->num);
}
return(p2);
}
void print(struct student * p2)
{
struct student *p;
p=p2;
do{
printf("%s\n",p->num);
p=p->next;
}while(p!=NULL);
}
int main()
{
print(creat());
return 0;
}
|
31
|
15056
|
struct student
{
char num[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->num);
head=NULL;
while(strcmp(p1->num,"end"))
{
n++;
p1->next=head;
head=p1;
p1=(struct student*)malloc(LEN);
gets(p1->num);
}
p1->next=NULL;
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head)
do
{
puts(p->num);
p=p->next;
}
while(p);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15057
|
struct student{
char num[10];
char name[20];
char gd;
int age;
float sc;
char adr[10];
struct student *next;
};
struct student *append()
{
struct student *head,*p1,*p2=NULL;
while(1)
{
p1=(struct student*)malloc(sizeof(struct student));
scanf("%s",p1->num);
if (p1->num[0]=='e')
{
head=p2;
break;
}
else
{
scanf("%s %c %d%f %s",p1->name,&p1->gd,&p1->age,&p1->sc,p1->adr);
p1->next=p2;
p2=p1;
}
}
return head;
}
void main()
{
struct student *p;
p=append();
for(;p!=NULL;p=p->next)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->gd,p->age,p->sc,p->adr);
}
}
|
31
|
15058
|
struct student
{
char num[10];
char name[20];
char c;
int age;
char score[10];
char addr[20];
struct student*next;
};
void main()
{
struct student *p1,*p2,*p,*head;
p1=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->c,&p1->age,p1->score,p1->addr);
p1->next=NULL;
do
{
p2=(struct student*)malloc(LEN);
scanf("%s",p2->num);
if(strcmp(p2->num,"end")==0)
{
head=p1;
break;
}
else
{
scanf("%s %c %d%s%s",p2->name,&p2->c,&p2->age,p2->score,p2->addr);
p2->next=p1;
p1=p2;
}
}while(strcmp(p2->num,"end")!=0);
p=head;
do
{
if(p->next==NULL)
break;
printf("%s %s %c %d %s %s\n",p->num,p->name,p->c,p->age,p->score,p->addr);
if(p->next!=NULL)
p=p->next;
}while(p->next!=NULL);
printf("%s %s %c %d %s %s\n",p->num,p->name,p->c,p->age,p->score,p->addr);
}
|
31
|
15059
|
struct student
{
char number[20];
char name[20];
char c;
int age;
float score;
char address[30];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int m;
n=0;
p1=p2=(struct student*)malloc(LEN);
head=NULL;
scanf("%s",p1->number);
for(m=0;;m++)
{
if(strcmp(p1->number,"end")!=0)
{
scanf("%s %c %d %f %s",p1->name,&p1->c,&p1->age,&p1->score,p1->address);
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
}
else break;
scanf("%s",p1->number);
}
p2->next=NULL;
return(head);
}
struct student *del(struct student *head,char *str)
{
struct student *p1,*p2;
p1=head;
while(strcmp(str,p1->number)!=0&&p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(strcmp(str,p1->number)==0)
{
if(p1==head)head=p1->next;
else p2->next=p1->next;
n=n-1;
}
return(head);
}
void main()
{
struct student *head,*p1;
head=creat();
while(head!=NULL)
{
p1=head;
while(p1->next!=NULL)
p1=p1->next;
printf("%s %s %c %d %g %s\n",p1->number,p1->name,p1->c,p1->age,p1->score,p1->address);
head=del(head,p1->number);
}
}
|
31
|
15060
|
struct student
{
char name[32],sex,address[32],id[10],score[10];
int age;
struct student *next;
};
struct student *create()
{
struct student *head=NULL,*p1,*p2;
char ch[10];
p1=p2=(struct student*)malloc(Len);
scanf("%s %s %c %d %s %s",p1->id,p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
head=p1;
p2=p1;
do
{
scanf("%s",ch);
if(strcmp(ch,"end")==0) break;
else
{ p1=(struct student*)malloc(Len);
strcpy(p1->id,ch);
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
}while(1);
return head;
}
void print(struct student *head)
{
struct student *p1,*p2;
while(p1)
{
p1=head;
if(p1->next==NULL)
{
printf("%s %s %c %d %s %s",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->address);
break;
}
else
{
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->address);
p2->next=NULL;
free(p1);
}
}
}
int main()
{
struct student *head;
head=create();
print(head);
}
|
31
|
15061
|
main()
{
struct student
{
char num[100];
char name[100];
char sex[10];
char age[10];
char score[10];
char address[100];
struct student *next;
};
struct student *head,*p1;
p1=(struct student*)malloc(sizeof(struct student));
head=NULL;
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
scanf("%s%s%s%s%s",p1->name,p1->sex,p1->age,p1->score,p1->address);
p1->next=head;
head=p1;
p1=(struct student*)malloc(sizeof(struct student));
scanf("%s",p1->num);
}
p1=head;
while(p1!=NULL)
{
printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
p1=p1->next;
}
}
|
31
|
15062
|
main()
{
int n=0;
struct b
{
char a[60];
}d,*q[10000];
while(1)
{
gets(d.a);
if(d.a[0]=='e')
break;
q[n]=(struct b *)malloc(sizeof(struct b));
*q[n]=d;
n++;
}
while(n--)
{
puts(q[n]->a);
}
}
|
31
|
15063
|
struct num
{int nianling;
float defen;
char q[200],w[100],xingbie,xuehao[200];
struct num *next;
};
struct num *crea()
{long i;
struct num *head;
struct num *p1,*p2;
p1=p2=(struct num *)malloc(LEN);
head=p1;
scanf("%s %s %c %d %f %s",&p1->xuehao,&p1->q,&p1->xingbie,&p1->nianling,&p1->defen,&p1->w);
head->next=NULL;
for(;;)
{
p1=(struct num *)malloc(LEN);
scanf("%s",&p1->xuehao);if(p1->xuehao[0]!='e')
{scanf("%s %c %d %f %s",&p1->q,&p1->xingbie,&p1->nianling,&p1->defen,&p1->w);
p1->next=p2;
p2=p1;}
else {p1->next=p2,p2=p1;break;}
}
return(p1);
}
void main()
{
long nx,m,m0,tx,qx,q,mxh;
struct num *hi,*p,*t;
hi=crea();
t=hi->next;
for(p=t;p!=NULL;p=p->next)
{printf("%s %s %c %d %g %s\n",p->xuehao,p->q,p->xingbie,p->nianling,p->defen,p->w);
}
}
|
31
|
15064
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char address[50];
struct student *next;
};
void main()
{
struct student *head,*p,*s;
head=(struct student *)malloc(sizeof(struct student));
head->next=NULL;
p=head->next;
for(;;)
{
s=(struct student *)malloc(sizeof(struct student));
s->next=NULL;
scanf("%s",s->num);
if(strcmp(s->num,"end")==0)
break;
scanf("%s %c %d %s %s",s->name,&s->sex,&s->age,s->score,s->address);
head->next=s;
s->next=p;
p=s;
}
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
}
|
31
|
15065
|
struct Student
{
char no[10];
char name[20];
char sex;
int age;
char score[7];
char add[15];
struct Student *next;
};
int main()
{
struct Student *p[1000],*head;
int i;
for(i=0; ;i++)
{
p[i]=(struct Student *)malloc(LEN);
scanf("%s",p[i]->no);
if(strcmp(p[i]->no,"end")==0)
{
head=p[i-1];//head????
break;//???end???
}
else
{
getchar();
scanf("%s %c %d %s %s",p[i]->name,&p[i]->sex,&p[i]->age,p[i]->score,p[i]->add);
getchar();
if(i==0)
{
p[i]->next=NULL;//????????????????????
}
else
{
p[i]->next=p[i-1];//????????????????
}
}
}
for(head=head;head!=NULL;head=head->next)
{
printf("%s %s %c %d %s %s\n",head->no,head->name,head->sex,head->age,head->score,head->add);
}
return 0;
}
|
31
|
15066
|
struct student
{
char num[10];
char s1[20];
char sex;
int age;
char mark[20];
char s2[20];
struct student*next;
} *p1,*p2;//????????????????????????//
int n;
//????//
struct student * creat(void)
{
struct student * head;
n=0;
p1 = p2 = (struct student * )malloc(LEN);
scanf("%s", p1->num);
while(strcmp(p1->num,"end")!=0)//?????????//
{
scanf ("%s %c %d %s %s", p1->s1,&p1->sex, &p1->age, p1->mark, p1->s2);//?????????????//
n=n+1;
if (n==1)
{
head=p1;//?????????//
}
else
{
p2->next=p1;
}
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);//??p1->num???while?????//
}
p2->next=NULL;
return(head);
}//?????????????//
struct student * turnback(struct student * head)//??????//
{
struct student * newhead = NULL;
struct student * anew;//?????????????????//
do{
p2 = NULL;
p1 = head;
while(p1->next !=NULL)
{
p2=p1;
p1=p1->next;
}
if(newhead==NULL)
{
newhead = p1;
anew = newhead->next = p2;//??anew????????//
}
anew = anew->next =p2;
p2->next=NULL;
}while(head->next !=NULL);
return newhead;//??????????//
}
//??????//
void print(struct student *head)
{
struct student *p;
p = head;
if(p !=NULL)
do{
printf("%s %s %c %d %s %s\n", p->num, p->s1, p->sex, p->age, p->mark, p->s2);
p = p->next;
}while(p !=NULL);
}
//???//
main()
{
struct student *head;
head = creat();
head = turnback(head);//?????????????//
print (head);//??????????/
return 0;
}
|
31
|
15067
|
struct stu
{
char num[15];
char name[20];
char sex;
int year;
char score[20];
char adr[15];
struct stu *next;
}*p,*q,*head,*newhead,*ne;
struct stu *creat(void)
{
char a[15];
head=null;
scanf("%s",&a);
while(strlen(a)!=3)
{
p=(struct stu *)malloc(l);
strcpy(p->num,a);
scanf("%s %c %d %s %s",p->name,&p->sex,&p->year,p->score,p->adr);
if(head==null)
q=head=p;
else
q=q->next=p;
scanf("%s",a);
}
q->next=null;
return (head);
}
struct stu * change(struct stu *head)
{
newhead=null;
do
{
q=null;
p=head;
while(p->next!=null)
{
q=p;
p=p->next;
}
if(newhead==null)newhead=p,ne=newhead->next=q;
ne=ne->next=q;
q->next=null;
}while(head->next!=null);
return (newhead);
}
void output(struct stu *newhead)
{
p=newhead;
while(p!=null)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->adr);
p=p->next;
}
}
int main()
{
head=creat();
newhead=change(head);
output(newhead);
}
|
31
|
15068
|
struct stu
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char adr[15];
struct stu *next;
}student;
int i;
struct stu *creat(void)
{
struct stu *p1,*p2,*head;
p1=p2=(struct stu *) malloc(sizeof (struct stu));
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
head=0;
i=0;
while(1)
{
if(i==0)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct stu *) malloc(LEN);
scanf("%s",p1->num);
if(p1->num[0]=='e')
break;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->adr);
i++;
}
return(head);
}
void main()
{
struct stu *p,*head;
int j;
head=creat();
for(;i>0;i--)
{
p=head;
for(j=0;j<i;j++)
{
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr);
}
printf("%s %s %c %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->adr);
}
|
31
|
15069
|
struct people
{
char num[20];
char name[20];
char sex;
char age[5];
char score[10];
char address[30];
};
struct people child[1000];
void main()
{
int i;
for(i=0;;i++)
{
scanf("%s",child[i].num);
if (strcmp(child[i].num,"end")==0)
break;
scanf("%s %c%s%s%s",child[i].name,&child[i].sex,child[i].age,child[i].score,child[i].address);
}
for(i--;i>=0;i--)
{
printf("%s %s %c %s %s %s\n",child[i].num,child[i].name,child[i].sex,child[i].age,child[i].score,child[i].address);
}
}
|
31
|
15070
|
struct student{
char stu[50];
struct student *next;
};
struct student *Create();
void Insert(struct student *head,struct student *newnode);
void Print(struct student *head);
int main(){
struct student tmp;
struct student *head;
head=Create();
gets(tmp.stu);
while(strcmp(tmp.stu,"end")!=0){
Insert(head,&tmp);
gets(tmp.stu);
}
Print(head);
return 0;
}
struct student *Create()
{
struct student *p;
p=(struct student *)malloc(sizeof(struct student));
strcpy(p->stu,"0");
p->next=NULL;
return p;
}
void Insert(struct student *head,struct student *tmp)
{
struct student *p;
struct student *newnode;
p=head;
while(p->next!=NULL)
p=p->next;
newnode=(struct student *)malloc(sizeof(struct student));
p->next=newnode;
strcpy(newnode->stu,tmp->stu);
newnode->next=NULL;
}
void Print(struct student *head)
{
if(head->next!=NULL)
Print(head->next);
if(strcmp(head->stu,"0")!=0)
printf("%s\n",head->stu);
}
|
31
|
15071
|
main()
{
struct student
{
char num[20];
char name[20];
char sex;
int age;
float score;
char ad[20];
struct student *next;
};
struct student *head,*p1,*p2;
int n=0;
p1=p2=( struct student*) malloc(LEN);
scanf("%s%s %c%d%f%s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,&p1->ad);//???????????
p1->next=NULL;
head=NULL;
while (n!=1)
{
p1=(struct student*)malloc(LEN);
scanf("%s",&p1->num);
if (strcmp(p1->num,"end")!=0)
{
scanf("%s %c%d%f%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->ad);
p1->next=p2;
p2=p1;
}
else
n=1;
}
head=p2;
p1=head;
while (p1!=NULL)
{
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->ad);
p1=p1->next;
}
}
|
31
|
15072
|
struct sd
{char xh[100];char xm[100];char xb;int nl;double df;char dz[10];struct sd*before;};
struct sd* cre()
{struct sd *p1,*p2=NULL;
while(1){p1=(struct sd*)(malloc(sizeof(struct sd)));
scanf("%s",p1->xh);
if(strcmp(p1->xh,"end")==0)break;
else{ p1->before=p2;p2=p1;
scanf("%s %c %d %lf %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz); }}
return p2;
}
void main()
{struct sd*cre();
struct sd*p=cre();
while(1){printf("%s %s %c %d %g %s\n",p->xh,p->xm,p->xb,p->nl,p->df,p->dz);
if(p->before==NULL)break;
else p=p->before; }}
|
31
|
15073
|
struct student
{
char stuID[20];
char name[20];
char sex;
int age;
char score[10];
char add[20];
};
int main()
{
int i,j;
struct student stu[5000];
scanf("%s %s %c %d %s %s",stu[0].stuID,stu[0].name,&stu[0].sex,&stu[0].age,stu[0].score,stu[0].add);
i=0;
if(strlen(stu[i].stuID)>=3)
{
while(1)
{
i++;
scanf("%s",stu[i].stuID);
if(strlen(stu[i].stuID)==3)
break;
scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
}
//printf("#####3");
for(j=i-1;j>=0;j--)
{
printf("%s %s %c %d %s %s\n",stu[j].stuID,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add);
}
}
return 0;
}
|
31
|
15074
|
struct student
{
char data[500];
struct student *former;
};
int n;
struct student *create()
{
struct student *tail;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
gets(p1->data);
tail=NULL;
while(strcmp(p1->data,"end")!=0)
{
n=n+1;
if (n==1)
{
tail=p1;
p1->former=NULL;
}
else
{
tail=p1;
p1->former=p2;
p2=p1;
}
p1=(struct student *)malloc(sizeof (struct student));
gets(p1->data);
}
return(tail);
}
int main()
{
struct student *p,*start;
p=create();
start=p;
if (p!=NULL)
{
do
{
puts(start->data);
start=start->former;
}
while (start!=NULL);
}
}
|
31
|
15075
|
int main()
{
struct student {
char ID[30];
char name[30];
char sex;
int age;
float score;
char address[20];
}message[1000];
int num=0;
for(;;num++)
{
cin>>message[num].ID;
if (message[num].ID[0]!='e')//??????
{cin>>message[num].name>>message[num].sex>>message[num].age>>message[num].score>>message[num].address;
}
else break;
}
for(int i=num-1;i>=0;i--)
cout<<message[i].ID<<' '<<message[i].name<<' '<<message[i].sex<<' '<<message[i].age<<' '<<message[i].score<<' '<<message[i].address<<endl;
return 0;
}
|
31
|
15076
|
struct student{
char xh[20];
char name[20];
char sex;
int age;
float score;
char dizhi[30];
struct student *next;
};
struct student *append(void)
{int n;
struct student *head,*newnode,*thisnode=NULL;
for (n=1;;n++)
{newnode=(struct student*)malloc(sizeof(struct student));
scanf("%s",&newnode->xh);
if (newnode->xh[0]=='e')
{head=thisnode;break;}
else
{scanf(" %s %c %d %f %s\n",&newnode->name,&newnode->sex,&newnode->age,&newnode->score,&newnode->dizhi);
newnode->next=thisnode;
thisnode=newnode;
}
}
return head;
}
void main()
{struct student *p;
for ( p=append();p!=NULL;p=p->next)
{printf("%s %s %c %d %g %s\n",p->xh,p->name,p->sex,p->age,p->score,p->dizhi);
}
}
|
31
|
15077
|
struct student
{
char num[50],ming[100];
struct student *pro;
};
int n;
struct student *tail;
struct student *creat()
{
struct student *head;
struct student *p1,*p2;
int i;
i=0;
p1=p2=(struct student *)malloc(len);
scanf("%s",p1->num);
head=0;
while (strcmp(p1->num,"end"))
{
gets(p1->ming);
i++;
if (i==1)
{
head=p1;
head->pro=0;
}
else
{
p1->pro=p2;
}
p2=p1;
p1=(struct student *)malloc(len);
scanf("%s",p1->num);
}
tail=p2;
return(tail);
}
main()
{
struct student *p;
creat();
p=tail;
for (;p!=0;)
{
printf("%s%s\n",p->num,p->ming);
p=p->pro;
}
}
|
31
|
15078
|
struct stu
{char info[50];
struct stu *next;
}*p1,*p2;
int n;
struct stu *creat(void)
{struct stu *head=NULL;
n=0;
p1=p2=(struct stu *)malloc(sizeof(struct stu));//???????
gets(p1->info);
while(strcmp(p1->info,"end")!=0)
{n++;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct stu *)malloc(sizeof(struct stu));
gets(p1->info);
}
p2->next=NULL;
return (head);
}
struct stu * turnback(struct stu *head)
{
struct stu *New,*Newhead=NULL;
do{
p2=NULL;
p1=head;
while(p1->next!=NULL)
{p2=p1;
p1=p1->next;
}
if(Newhead==NULL)
{
Newhead=p1;
New=Newhead->next=p2;
}
New=New->next=p2;
p2->next=NULL;
}while(head->next!=NULL);
return(Newhead);
}
void output(struct stu *head)
{for(p1=head;p1!=NULL;puts(p1->info),p1=p1->next);
}
void main()
{
struct stu *head;
head=creat();
head=turnback(head);
output(head);
}
|
31
|
15079
|
struct link
{
char s[100];
struct link *next;
struct link *last;
} ;
struct link *create()
{
struct link *last,*head,*p;
char s[100];
head=(struct link*)malloc(LEN);
last=head;
do
{
gets(s);
if (strlen(s)==3) break;
p=(struct link*)malloc(LEN);
strcpy(p->s,s);
last->next=p;
p->last=last;
last=p;
}
while (0==0);
last->next=NULL;
head=head->next;
head->last=NULL;
return head;
}
void nprint(struct link *p)
{
struct link *last;
while (p!=NULL)
{
last=p;
p=p->next;
}
p=last;
while (p!=NULL)
{
puts(p->s);
p=p->last;
}
}
int main()
{
struct link *p;
p=create();
nprint(p);
}
|
31
|
15080
|
struct student
{
char inf[50];
struct student *next;
};
int main()
{
struct student *head,*p;
p=(struct student*)malloc(LEN);
gets(p->inf);
head=NULL;
while (p->inf[0]!='e')
{
p->next=head;
head=p;
p=(struct student*)malloc(LEN);
gets(p->inf);
}
p=head;
while(true)
{
printf("%s",p->inf);
p=p->next;
if (p==NULL) break;
else printf("\n");
}
return 0;
}
|
31
|
15081
|
struct student
{
char id[50];
char name[50];
char sex;
int age;
double grade;
char a[20];
struct student *next;
};
void main()
{
struct student *h,*p,*q;
int n=0;
p=(struct student*)malloc(LEN);
scanf("%s",p->id);
while(p->id[0]!='e')
{
scanf("%s %c%d%lf%s",p->name,&p->sex,&p->age,&p->grade,p->a);
n=n+1;
if(n==1) p->next=NULL;
else p->next=h;
h=p;
p=(struct student *)malloc(LEN);
scanf("%s",p->id);
}
p=h;
do
{
printf("%s %s %c %d %g %s\n",p->id,p->name,p->sex,p->age,p->grade,p->a);
p=p->next;
}
while(p!=NULL);
}
|
31
|
15082
|
struct student
{
char str[100];
struct student *next;
};
int isequal(char *a);
int main()
{
struct student *head,*p1,*p2;
p1=(struct student*)malloc(sizeof(struct student));
gets(p1->str);
p1->next=NULL;
if(isequal(p1->str))
{
free(p1);
head=NULL;
}
else
{
head=p1;
p2=p1;
do
{
p1=(struct student*)malloc(sizeof (struct student));
gets(p1->str);
p1->next=NULL;
if (isequal(p1->str))
{
free(p1);
break;
}
else
{
head=p1;
p1->next=p2;
p2=p1;
}
}
while(1);
}
struct student *p;
p=head;
while(p)
{
printf("%s",p->str);
p=p->next;
if (p != NULL)
printf("\n");
}
return 0;
}
int isequal(char *a)
{
if (a[0] == 'e' && a[1] == 'n' && a[2] == 'd' && a[3] == 0)
return 1;
else
return 0;
}
|
31
|
15083
|
struct student
{
char num[30];
char name[30];
char sex;
int age;
char score[30];
char add[30];
struct student *next;
};
int n=0;
void main()
{
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);
while(1)
{
n++;
if(n==1) p1->next=NULL;
else p1->next=p2;
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->score,p1->add);
}
head=p2;
p1=head;
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
do
{
p1=p1->next;
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}
while(p1->next!=NULL);
}
|
31
|
15084
|
void main()
{
struct stu
{
char num[21];
char name[31];
char sex[2];
int age;
float score;
char address[31];
struct stu *next;
struct stu *pre;
};
struct stu *head,*p1,*p2,*tail;
head=(struct stu *)malloc(sizeof(struct stu));
p1=head;
p2=p1;
p1->pre=NULL;
scanf("%s",&p1->num);
if (strcmp(p1->num,"end"))
{
while(strcmp(p1->num,"end"))
{
scanf("%s",&p1->name);
scanf("%s",&p1->sex);
scanf("%d",&p1->age);
scanf("%f",&p1->score);
scanf("%s",&p1->address);
p2=(struct stu*)malloc(sizeof(struct stu));
p1->next=p2;
p2->pre=p1;
p1=p2;
scanf("%s",&p1->num);
}
tail=p1->pre;
free(p1);
tail->next=NULL;
p1=tail;
p2=p1;
while(p1!=NULL)
{
printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
p2=p1->pre;
p1=p2;
}
p1=head;
p2=p1;
while(p1!=NULL)
{
p2=p1->next;
free(p1);
p1=p2;
}
}
else
free(head);
}
|
31
|
15085
|
struct link
{
char a[10][100];
struct link *next;
};
struct link *now,*past;
int i,n=1;
void build()
{
while (1)
{
now=(struct link*)malloc(sizeof(struct link));
scanf("%s",now->a[0]);
if (strcmp(now->a[0],"end")==0) return;
for (i=1;i<6;i++)
scanf("%s",now->a[i]);
if (n==1)
{
now->next=NULL;
} else now->next=past;
past=now;
n++;
}
}
void main()
{
build();
now=past;
while (now!=NULL)
{
printf("%s",now->a[0]);
for (i=1;i<6;i++)
printf(" %s",now->a[i]);
printf("\n");
now=now->next;
}
}
|
31
|
15086
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[6];
char addr[20];
struct student *former;
};
int n;
struct student *create()
{
n=0;
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
scanf("%s",p1->num);
while(p2->num[0]!='e')
{
n++;
if(n==1)
p1->former=NULL;
else p2->former=p1;
p1=p2;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
p2=(struct student*)malloc(LEN);
scanf("%s",p2->num);
}
return(p1);
}
void print(struct student*head)
{
struct student *p;
p=head;
while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->former;
}
}
void main()
{
struct student *head;
head=create();
print(head);
}
|
31
|
15087
|
struct stu{char id[20];char name[20];char sex;int age;char score[20];char address[20];struct stu *next;struct stu *former;};
struct stu *cr(void)
{struct stu *head,*end;
struct stu *p1,*p2;
int i=0;
p1=p2=(struct stu*)malloc(LEN);
scanf("%s",&p1->id);
if(strcmp(p1->id,"end")!=0)
{ scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);//printf("%s",p1->name);
head=NULL;
while(1)
{
i++;
if(i==1) {head=p1;p1->former=NULL;}
else {p2->next=p1;p1->former=p2;}
p2=p1; p1=(struct stu*)malloc(LEN);
scanf("%s",&p1->id);
if(strcmp(p1->id,"end")==0)break;
// printf("%s",p1->id);
scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
}
p2->next=NULL;
end=p2;
return (end);
}
else return(NULL);
}
void print(struct stu *end)
{
struct stu *q=end; // printf("%s",end->id);
while(q!=NULL&&end!=NULL)
{
printf("%s %s %c %d %s %s\n",q->id,q->name,q->sex,q->age,q->score,q->address);
q=q->former;//printf("%s",q->id);
}
//printf("%s",q->id);
}
int main()
{struct stu *p;
p=cr();
print(p);
return 0;
}
|
31
|
15088
|
struct student
{
char num[100];
char name[100];
char sex[2];
int age;
char score[20];
char addr[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2=NULL;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if (strcmp(p1->num,"end")!=0)
{
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->addr);
p1->next=NULL;
p2=p1;
while (1)
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
if (strcmp(p1->num,"end")==0)
break;
else
{
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->addr);
p1->next=p2;
p2=p1;
}
}
}
head=p2;
return(head);
}
void print(struct student *head)
{
struct student *p1;
p1=head;
while(p1!=NULL)
{
printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->next;
}
}
void main()
{
struct student *head=NULL;
head=creat();
print(head);
}
|
31
|
15089
|
struct Student
{
char id[10];
char name[100];
char sex;
char year[10];
char mark[10];
char ad[20];
}stu[1000];
int main()
{
int i,k=0;
for(i=0;;i++)
{
scanf("%s ",stu[i].id);
if(stu[i].id[0]=='e')
{break;}
else
{scanf("%s %c %s %s %s\n",stu[i].name,&stu[i].sex,stu[i].year,stu[i].mark,stu[i].ad);
k++;}
}
for(i=k-1;i>=0;i--)
printf("%s %s %c %s %s %s\n",stu[i].id,stu[i].name,stu[i].sex,stu[i].year,stu[i].mark,stu[i].ad);
}
|
31
|
15090
|
struct Student
{
char id[9];
char name[20];
char gen;
int age;
char grade[10];
char add[20];
struct Student *next;
};
void main()
{
struct Student *head,*p2,*p1,*newstu,*newhead;
int i,n=1;
char e[]={"end"};
p1=p2=head=(struct Student*)malloc(sizeof(struct Student));
scanf("%s %s %c %d %s %s",
&p1->id,&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
while(1)
{
p1=(struct Student*)malloc(sizeof(struct Student));
scanf("%s",&p1->id);
if(strcmp(p1->id,e)==0) {p2->next=NULL;break;}
else
{
scanf(" %s %c %d %s %s",
&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
p2->next=p1;
p2=p1;
n++;
}
}
for(i=0;i<n;i++)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(i==0)
newhead=newstu=p1;
else
newstu=newstu->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<n;i++)
{
printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->gen,p1->age,p1->grade,p1->add);
p1=p1->next;
}
}
|
31
|
15091
|
struct w
{char id[100];
struct w *next;
};
struct w *head,*new,*newhead,*p1,*p2;
int i,n;
struct w *create(void)
{
n=0;
head=null;
p1=p2=(struct w *)malloc(len);
gets(p1->id);
while(strcmp(p1->id,"end")!=0)
{
n++;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct w *)malloc(len);
gets(p1->id);
}
p2->next=null;
return head;
}
void main()
{
head=create();
for(i=0;i<n;i++)
{p2=p1=head;
while(p1->next!=null)
{p2=p1;p1=p1->next;}
if(i==0) newhead=new=p1;
else new=new->next=p1;
p2->next=null;
}
p1=newhead;
for(i=0;i<n;i++)
{printf("%s\n",p1->id);
p1=p1->next;
}
}
|
31
|
15092
|
void main()
{
char stu[10000][100],tem[100]={'e','n','d'};
int i,j;
for (i=0;i<10000;i++)
{
gets(stu[i]);
if (strcmp(stu[i],tem)==0)break;
}
for(j=i-1;j>=0;--j)
printf("%s\n",stu[j]);
}
|
31
|
15093
|
int i=0;
struct shuju
{
char xh[20];
char xm[20];
char sex;
int age;
char fen[10];
char dorm[20];
struct shuju * next;
};
struct shuju *create()
{
struct shuju *head,*p1,*p2;
p1=(struct shuju* )malloc(len);
scanf("%s %s %c %d %s %s",p1->xh,p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
head=p1;
while (1)
{
i++;
p2=p1;
p1=(struct shuju* )malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")==0) {free(p1);break;}
else
{scanf("%s %c %d %s %s",p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
p2->next=p1;}
}
p2->next=NULL;
return (head);
}
/*struct shuju*create()
{
struct shuju *head,*p1,*p2;
p1=(struct shuju *)malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")!=0){
scanf("%s %c %d %d %s",p1->xm,&p1->sex,&p1->age,&p1->fen,p1->dorm);
p1->next=NULL;
head=p1;
p2=p1;
do
{
i++;
p1=(struct shuju* )malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")==0)
{
free(p1);break;
}
else
{
scanf("%s %c %d %d %s",p1->xm,&p1->sex,&p1->age,&p1->fen,p1->dorm);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
}
while(1);}
else{head=NULL;}
return(head);
}*/
void print(struct shuju* head)
{
int j;
struct shuju* p,*pre;
for (j=0;j<i;j++)
{
p=head;
pre=p;
while (p->next!=NULL)
{
pre=p;
p=p->next;
}
printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
pre->next=NULL;}
}
void main()
{
struct shuju *p;
p=create();
print(p);
}
|
31
|
15094
|
struct Student
{
char ID[10];
char name[20];
char sex;
int age;
float score[20];
char add[20];
struct Student*next;
};
int main()
{
struct Student a[1000],*head,*p;
int i,j;
for(i=0;;i++)
{
scanf("%s %s %c %d %s %s",a[i].ID,a[i].name,&a[i].sex,&a[i].age,a[i].score,a[i].add);
if(a[i].ID[2]=='d')
{
printf("\n");
break;
}
}
for(j=i-1;j>=0;j--)
{
head=&a[i-1];
a[j].next=&a[j-1];
a[0].next=NULL;
p=head;
}
do
{
printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}while(p!=NULL);
return 0;
}
|
31
|
15095
|
int main()
{
int i,n;
char a[MAX][MAX];
for(i=0; ;i++)
{
gets(a[i]);
if(strcmp(a[i],"end")==0) break;
}
for(n=i-1;n>=0;n--)
{
puts(a[n]);
}
return 0;
}
|
31
|
15096
|
struct Student
{
struct Student *prev;
char number[30];
char name[30];
char gender;
int age;
double score;
char address[30];
};
int main()
{
struct Student a,*p;
scanf("%s%s %c%d%lf%s",a.number,a.name,&a.gender,&a.age,&a.score,a.address);
p=(struct Student *)malloc(LEN);
*p=a;
(*p).prev=NULL;
for(;1;)
{
scanf("%s",a.number);
if(a.number[0]=='e')
break;
scanf("%s %c%d%lf%s",a.name,&a.gender,&a.age,&a.score,a.address);
a.prev=p;
p=(struct Student *)malloc(LEN);
*p=a;
}
printf("%s %s %c %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
for(;(*p).prev!=NULL;)
{
p=p->prev;
printf("%s %s %c %d %g %s\n",p->number,p->name,p->gender,p->age,p->score,p->address);
}
return 0;
}
|
31
|
15097
|
struct student
{
char num[10];
char name[20];
char gender[2];
int year;
char score[10];
char ad[20];
struct student *next;
};
int main()
{
int i,count=0;
struct student *head,*p1,*p2,*p,*q,*temp;
for(i=1;i<=10000;i++){
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0){
head=temp;
break;
}
else if(i==1){
p1->next=NULL;
p2=p1;
temp=p1;
}
else{
p1->next=p2;
p2=p1;
temp=p1;
}
scanf("%s",p1->name);
scanf("%s",p1->gender);
scanf("%d",&p1->year);
scanf("%s",p1->score);
scanf("%s",p1->ad);
count=count+1;
}
for(i=1;i<=count;i++){
if(i==1){
p=head;
}
printf("%s %s %s %d %s %s\n",p->num,p->name,p->gender,p->year,p->score,p->ad);
p=p->next;
if(p==NULL){
break;
}
}
return 0;
}
|
31
|
15098
|
struct stu
{
char num[15];
char name[20];
char gender;
int age;
char score[10];
char add[20];
struct stu *next;
};
int n;
struct stu *creat(void)
{
struct stu *head,*p,*q;
p=q=(struct stu*)malloc(LEN);
scanf ("%s%s %c %d %s%s",(*p).num,(*p).name,&(*p).gender,&(*p).age,(*p).score,(*p).add);
for (n=0;(*p).gender=='f'||(*p).gender=='m';n++)
{
if (n==0) (*p).next=NULL;
else (*p).next=q;
q=p;
p=(struct stu*)malloc(LEN);
scanf("%s%s %c %d %s%s",(*p).num,(*p).name,&(*p).gender,&(*p).age,(*p).score,(*p).add);
}
head=q;
return(head);
}
void print(struct stu *head)
{
struct stu *p;
if (head!=NULL)
for (p=head;p!=NULL;p=(*p).next)
printf("%s %s %c %d %s %s\n",(*p).num,(*p).name,(*p).gender,(*p).age,(*p).score,(*p).add);
}
void main()
{
struct stu *head;
head=creat();
print(head);
}
|
31
|
15099
|
/*
* justexp.cpp
*
* Created on: 2011-11-18
* Author: dell
*/
int main()
{
struct data
{
char num[200];
char name[200];
char gender;
int age;
float score;
char add[200];
}student[2000];
int count=0;
while(true)
{
memset(student[count].num,'\0',sizeof(student[count].num));
cin>>student[count].num;
if(strcmp(student[count].num,"end")==0)
break;
cin>>student[count].name>>student[count].gender>>student[count].age>>student[count].score>>student[count].add;
count++;
}
while(count--)
{
cout<<student[count].num<<" "<<student[count].name<<" "<<student[count].gender<<" "<<student[count].age<<" "<<student[count].score<<" "<<student[count].add<<endl;
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.