label
stringlengths 1
2
| index
stringlengths 1
5
| code
stringlengths 87
8.24k
|
|---|---|---|
31
|
15100
|
struct Student
{
char inf[81];
struct Student *front,*next;
};
int n;
struct Student *creat()
{
struct Student *head,*p1,*p2,*temp;
n=0;
p1=p2=(struct Student *)malloc(LEN);
gets(p1->inf);
head=NULL;
while(strcmp(p1->inf,"end")!=0)
{
n++;
if(n==1)
{
head=p1;p1->front=NULL;
}
else
{
p2->next=p1;
p1->front=temp;
}
p2=p1;
temp=p1;
p1=(struct Student *)malloc(LEN);
gets(p1->inf);
}
p2->next=NULL;
return(p2);
}
int main()
{
struct Student *pt;
pt=creat();
if(pt!=NULL)
{
do
{
puts(pt->inf);
pt=pt->front;
}
while(pt!=NULL);
}
return 0;
}
|
31
|
15101
|
struct student
{
char number[10];
char name[100];
char sex;
int age;
char score[20];
char add[20];
struct student *pre;
};
int n;
struct student *creat(void)
{
struct student *tail;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
scanf("%s %s %c %d %s %s",p1->number,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
p1->pre=NULL;
while(1)
{
n++;
tail=p1;
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->number);
if(strcmp(p1->number,"end")==0)
break;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
p1->pre=p2;
p2=p1;
}
return(tail);
}
void print(struct student *tail)
{
struct student *p;
p=tail;
do
{
printf("%s %s %c %d %s %s\n",p->number,p->name,p->sex,p->age,p->score,p->add);
p=p->pre;
}while(p!=NULL);
}
void main()
{
print(creat());
}
|
31
|
15102
|
struct student
{
struct student *last;
char a[100];
};
int main ()
{
// freopen ( "1.in" , "r" , stdin );
// freopen ( "1.out" , "w" , stdout );
char a[100];
struct student *p , *p1;
p = p1 = ( struct student * ) malloc ( sizeof ( struct student ) );
p1->last = NULL;
gets ( p1->a );
for ( ; ; )
{
gets ( a );
if ( strcmp ( a , "end" ) == 0 ) break;
p = ( struct student * ) malloc ( sizeof ( struct student ) );
strcpy ( p->a , a );
p->last = p1;
p1 = p;
}
for ( ; ; )
{
printf ( "%s" , p->a );
p = p->last;
if ( p == NULL ) break;
else printf ( "\n" );
}
return 0;
}
|
31
|
15103
|
struct stu
{
char info[1000];
struct stu * next;
};
struct stu * head;
struct stu * create()
{
char str1[]="end";
struct stu *p1,*p2,*p;
p1=(struct stu*)malloc(Len);
gets(p1->info);
p1->next=NULL;
if(strcmp(p1->info,str1)==0)
{
free(p1);
head=NULL;
return head;
}
else
{
head=p1;
p2=p1;
do{
p1=(struct stu*)malloc(Len);
gets(p1->info);
p=head;
if(strcmp(p1->info,str1)==0)
{
free(p1);
break;
}
else
{
p1->next=p2;
head=p1;
p2=p1;
}
}while(1);
return head;
}
}
void print(struct stu * head)
{
struct stu * p;
p=head;
if(head!=NULL)
do
{
puts(p->info);
p=p->next;
}while(p!=NULL);
}
void main()
{
create();
print(head);
}
|
31
|
15104
|
struct stu
{
char xuehao[20];
char name[20];
char sex[10];
int old;
float score;
char where[20];
struct stu *next;
};
void main()
{
struct stu *head,*p0,*p;
int i;
char a[4]="end\0";
head=NULL;
for(i=0;;i++)
{
p0=(struct stu*)malloc(LEN);
scanf("%s",p0->xuehao);
if(strcmp(p0->xuehao,a)==0)
break;
scanf("%s%s%d%f%s",p0->name,p0->sex,&p0->old,&p0->score,p0->where);
if(head==NULL)
{
head=p0;
p0->next=NULL;
p=p0;
}
else
{
head=p0;
p0->next=p;
p=p0;
}
}
for(p=head;p!=NULL;p=p->next)
{
printf("%s %s %s %d %g %s\n",p->xuehao,p->name,p->sex,p->old,p->score,p->where);
}
}
|
31
|
15105
|
//#include <memory.h>
struct information
{char info[50];
struct information*next;
};
struct information* creat()
{struct information *head,*p1,*p2;
p1=p2=(struct information*)malloc(len);
p1->next=NULL;
gets(p1->info);
while(strcmp(p1->info,"end")!=0)
{p2=p1;
p1=(struct information*)malloc(len);
gets(p1->info);
p1->next=p2;
}
return p2;
}
void print(struct information*head)
{
while(head!=NULL)
{printf("%s\n",head->info);
head=head->next;
}
}
main()
{struct information*head;
head=creat();
print(head);
}
|
31
|
15106
|
void main()
{
int i,j,k,m,n;
struct stu
{
char xh[100];
char xm[100];
char xb;
int nl;
float df;
char dz[100];
struct stu *af;
struct stu *bf;
};
struct stu *p1,*p2,*head;
head=p2=p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s %s %c %d %f %s",p1->xh,p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p1->bf=0;
for(i=1;;i++)
{
p1=(struct stu *)malloc(sizeof(struct stu));
scanf("%s",p1->xh);
if(strcmp(p1->xh,"end")==0)
{
head=p2;
break;
}
scanf("%s %c %d %f %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p2->af=p1;
p1->bf=p2;
p2=p1;
}
p1=head;
for(j=0;j<i;j++)
{
printf("%s %s %c %d %g %s\n",p1->xh,p1->xm,p1->xb,p1->nl,p1->df,p1->dz);
p1=p1->bf;
}
}
|
31
|
15107
|
void main()
{
struct student
{
char info[1000];
struct student *pre,*next;
} *head,*tail,*p;
int l;
l=sizeof(struct student);
head=(struct student*)malloc(l);
p=head;
p->pre=NULL;
p->next=NULL;
for (;;)
{
gets(p->info);
if (strcmp(p->info,"end")==0) {tail=p;break;}
p->next=(struct student*)malloc(l);
(p->next)->pre=p;
(p->next)->next=NULL;
p=p->next;
}
p=tail;
for (;;)
{
if (!(p->pre)) {free(p);break;}
puts((p->pre)->info);
p=p->pre;
free(p->next);
}
}
|
31
|
15108
|
struct student
{
char number[40];
char name[50];
char sex;
int age;
float score;
char address[50];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(Len);
head=NULL;
scanf("%s%s %c%d%f%s",p1->number,p1->name,&(p1->sex),&(p1->age),&(p1->score),p1->address);
n=0;
while(1){
n++;
if(n==1){
head=p1;
}else{
p2->next=p1;
}
p2=p1;
p1=(struct student*)malloc(Len);
scanf("%s",p1->number);
if(*p1->number=='e'){
break;
}
scanf("%s %c%d%f%s",p1->name,&(p1->sex),&(p1->age),&(p1->score),p1->address);
}
p2->next=NULL;
return(head);
}
struct student *reverse(struct student *head)
{
struct student *p1,*p2,*p3;
p1=head;
p2=p1;
p3=p1;
do
{
if(p3==head){
p3=p2->next;
p2=p3;
p1->next=NULL;
}else{
p3=p2->next;
p2->next=p1;
p1=p2;
p2=p3;
}
}while(p3!=NULL);
head=p1;
return (head);
}
int main()
{
struct student *head;
head=creat();
head=reverse(head);
struct student *p1;
p1=head;
while(p1!=NULL){
printf("%s %s %c %d %g %s\n",p1->number,p1->name,p1->sex,p1->age,p1->score,p1->address);
p1=p1->next;
}
return 0;
}
|
31
|
15109
|
//#include<stdlib.h>//
struct student
{
struct student *bef;
char n[10];
char s[20];
char sex;
int age;
char score[10];
char address[20];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",(p1->n),(p1->s),&(p1->sex),&(p1->age),p1->score,p1->address);
while(p1->n[0]!='e')
{
n=n+1;
if(n==1)
{
p1->bef=NULL;
}
else
{
p2->next=p1;
p1->bef=p2;
}
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s %s %c %d %s %s",p1->n,p1->s,&(p1->sex),&(p1->age),p1->score,p1->address);
}
p2->next=NULL;
return(p2);
}
int main()
{
struct student *p;
p=creat();
do
{
printf("%s %s %c %d %s %s\n",p->n,p->s,p->sex,p->age,p->score,p->address);
p=p->bef;
}while(p!=NULL);
return 0;
}
|
31
|
15110
|
typedef struct linknode
{
char inf[500];
struct linknode *next,*prev;
} snode,*ptr;
main ()
{
int i,a1,a2,j,min,k;
ptr head,p1,p2,p3;
k=0;
for (i=1;i<=5;i)
{
p1=(ptr)malloc(sizeof(snode));
if (k==0) {head=p1; p2=p1;}
else {(*p2).next =p1; (*p1).prev=p2;}
gets((*p1).inf);
if ((*p1).inf[0]!='e')
{
p2=p1; k++;
}
else
{
p1=p2; i=6;
}
}
for (i=1;i<=k;i++)
{
printf ("%s\n",(*p1).inf );
if (i!=k) p1=(*p1).prev ;
}
}
|
31
|
15111
|
struct list{
char no[10];
char name[20];
char gene;
unsigned int age;
float score;
char add[20];
struct list *next;
};
struct list *creat()
{
struct list *p1=NULL,*p2=NULL,*head;
int n=0;
do{
p2=p1;
p1=(struct list*)malloc(sizeof(struct list));
scanf("%s",p1->no);
if(*p1->no=='e')
{
head=p2;
free(p1);
break;
}
scanf("%s %c %d %f %s\n",p1->name,&p1->gene,&p1->age,&p1->score,p1->add);
if(n==0)p1->next=NULL;
if(n!=0)p1->next=p2;
n=1;
}while(1);
return head;
}
int main()
{
struct list *p;
p=creat();
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->no,p->name,p->gene,p->age,p->score,p->add);
p=p->next;
}
return 0;
}
|
31
|
15112
|
void main()
{
struct fy
{
char xh[100];
char xm[100];
char xb;
int nl;
float df;
char dz[100];
struct fy *pre;
};
struct fy *p,*node;
int n=1;
for(;;)
{
node= (struct fy *)malloc(sizeof(struct fy));
if(n==1) node->pre=NULL;
else node->pre=p;
scanf("%s",node->xh);
if(strcmp(node->xh,"end")==0) break;
scanf("%s %c %d %f %s",node->xm,&node->xb,&node->nl,&node->df,node->dz);
p=node;
n++;
}
for(;node->pre!=NULL;)
{
node=node->pre;
printf("%s %s %c %d %g %s\n",node->xh,node->xm,node->xb,node->nl,node->df,node->dz);
}
}
|
31
|
15113
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
float score;
char address[20];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
int num=0;
head=NULL;
while (1)
{
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if (strcmp(p1->num,"end")==0)
{
p2->next=NULL;
break;
}
else
{
scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
if (num==0)
head=p1;
else
p2->next=p1;
p2=p1;
num++;
}
}
n=num;
return (head);
}
void print (struct student *pt)
{
struct student *p,*pre;
int i;
for (i=1;i<=n;i++)
{
for (p=pre=pt;p->next!=NULL;p=p->next)
pre=p;
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
if (p!=pt)
{
pre->next=NULL;
free(p);
}
}
}
int main()
{
struct student *pt;
pt=creat();
print(pt);
return 0;
}
|
31
|
15114
|
struct student
{
char num[15];
char name[30];
char sex[2];
short age;
float score;
char address[30];
struct student *former;
};
void main()
{
struct student *p1,*p2;
p1=p2=(struct student *)malloc(LEN);
scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->sex,&p1->age,&p1->score,p1->address);
p1->former=NULL;
while(1)
{
p1=(struct student *)malloc(LEN);
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);
p1->former=p2;
p2=p1;
}
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->former;
}
}
|
31
|
15115
|
typedef struct Node{
char content[150];//??????????????????????????????)
struct Node *next;//??????
struct Node *front;
}node,*ptr;
main()
{
char temp[150],std[4] = "end";//std???????
ptr head = NULL,p,q;//head???
while(1){
gets(temp);
if(strcmp(temp,std) != 0){
p = (ptr)malloc(sizeof(node));
strcpy(p->content,temp);
p->next = NULL;
p->front = NULL;
if(head == NULL)
head = p;
else{
q->next = p;
p->front = q;
}
q = p;
}
else
break;
}
while(p != NULL){
printf("%s\n",p->content);
p = p->front;
}
}
|
31
|
15116
|
int main()
{
int m,n,i,s;
char a[1000][100];
for(i=1;;i++)
{
gets(a[i]);
if(strcmp(a[i],"end")==0)
break;
}
for(s=i-1;s>0;s--)
printf("%s\n",a[s]);
return 0;
}
|
31
|
15117
|
main()
{
char a[3000][50],end[5]="end";int i=-1;
do
{
i++;
gets(a[i]);
}
while(a[i][0]!='e');
i--;
while(i>=0)
{
puts(a[i]);
i--;
}
}
|
31
|
15118
|
struct Student
{
char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
struct Student *next;
};
int n;
struct Student *creat()
{
struct Student *head,*p1,*p2;
p1=p2=(struct Student *) malloc(LEN);
scanf("%s",p1->num);
while(p1->num[0]!='e')
{
n++;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
if(n==1) p1->next=NULL;
else
{
p1->next=p2;
p2=p1;
}
p1=(struct Student *) malloc(LEN);
scanf("%s",p1->num);
}
head=p2;
return head;
}
void print(struct Student *head)
{
struct Student *p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct Student *head;
head=creat();
print(head);
}
|
31
|
15119
|
struct student
{
char xuehao[10];
char xingming[20];
char xingbie;
int nianling;
float chengji;
char dizhi[20];
struct student *next;
};
struct student *creat()
{
int n=0;
struct student *head,*p1,*p2;
p1=p2=(struct student*)malloc(LEN);
while(1)
{
scanf("%s",p1->xuehao);
if(p1->xuehao[0]=='e')
{head=p2;
break;}
scanf("%s %c %d %f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->chengji,p1->dizhi);
if(n==0) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
n++;
}
return head;
}
int main()
{
struct student *p;
p=creat();
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->chengji,p->dizhi);
p=p->next;
}
return 0;
}
|
31
|
15120
|
int n;
struct student
{
char str[100];
struct student *pre;
} *p1, *p2;
struct student *create(void)
{
struct student *last, *head;
p1 = p2 = (struct student *)malloc(sizeof(struct student)); //????
gets(p1->str);//?????
head=NULL;
n=0;
while (strcmp(p1->str,"end")!=0)
{
n=n+1; //??????
if (n==1)
{
head=p1;
p1->pre = NULL;//??????pre??
}
else
{
p1->pre = p2;//????pre????????
}
p2 = p1;//?????
p1 = (struct student *)malloc(sizeof(struct student));//????
gets(p1->str);
}
last=p1->pre=p2;
return (last);
}
void main ()
{
struct student *create();
struct student *last, *p;
last=create();
p=last;
if(p==last)
printf("%s\n", p->str);
for( p=last;p=p->pre;printf("%s\n", p->str));
}
|
31
|
15121
|
//#define NULL 0
struct student
{
char num[20];
char name[20];
char sex;
int age;
char score[10];
char adress[20];
// struct student *next;
struct student *before;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
int n;
n=0;
p1=p2=(struct student *)malloc(LEN);
// scanf("%s %s %c %d %d %s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->adress);
scanf("%s",p1->num);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{
scanf(" %s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->adress);
n++;
if(n==1)
{
// head=p1;
p1->before=NULL;
}
else
{
p1->before=p2;
head=p1;
}
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
/* if(strcmp(p1->num,"end")==0)
break;
else
scanf(" %s %c %d %d %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->adress);*/
}
// head=p2;
return(head);
}
void main()
{
struct student *head,*q1;
head=creat();
q1=head;
if(head!=NULL)
{
while(q1!=NULL)
{
printf("%s %s %c %d %s %s\n",q1->num,q1->name,q1->sex,q1->age,q1->score,q1->adress);
q1=q1->before;
}
// printf("%s %s %c %d %d %s\n",q1->num,q1->name,q1->sex,q1->age,q1->score,q1->adress);
}
}
|
31
|
15122
|
int i,n,m,t;
struct stu
{
char num[1000];
struct stu *next;
};
struct stu *creat(void)
{
struct stu *head;
struct stu *p1,*p2;
n=0;
p1=p2=(struct stu *)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 stu *)malloc(len);
gets(p1->num);
}
p2->next=NULL;
return (head);
}
void print(struct stu *head)
{
struct stu *p1,*p2;
m=n;
t=n;
for(i=1;n>0;i++)
{
while(n>0)
{
if(n==t) p2=p1=head;
else p2=p1;
p1=p1->next;
n=n-1;
}
printf("%s\n",p2->num);
n=m-i;
t=n;
}
}
void main()
{
struct stu *head;
head=creat();
print(head);
}
|
31
|
15123
|
struct student
{
char num[30];
char name[30];
char sex;
int age;
char score[20];
char add[30];
struct student *next;
};
int main()
{
struct student *p,*p1;
int n=0;
p=(struct student *)malloc(LEN);
scanf("%s %s %c %d %s %s",p->num,p->name,&p->sex,&p->age,p->score,p->add);
//printf("%s %s %c %d %f %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
//printf("%c\n",p->num[0]);
while(1)
{
n++;
if(n==1) p->next=NULL;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
//printf("%s\n",p1->num);
if(strcmp(p1->num,"end")==0) break;
else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
//printf("%s %s %c %d %f %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1->next=p;
p=p1;
//printf("%d\n",n);
}
//printf("%d\n",n);
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
|
15124
|
struct stu
{char id[100];
char name[100];
char sex[3];
char age[10];
char score[10];
char add[100];
struct stu *next;
};
int main()
{
int k,m,n,t,ans,ii,i,j,jj,flag;
struct stu *p0,*p1,*p2,*head;
char s[30];
p1 = (struct stu*)malloc(LEN);
scanf("%s%s%s%s%s%s",p1->id,p1->name,p1->sex,&p1->age,&p1->score,p1->add);
p1->next = NULL;
head = p1;
p2 = p1;
while (1)
{
p1 = (struct stu*)malloc(LEN);
scanf("%s",p1->id);
if (strcmp(p1->id,"end")==0)
{
head = p2;
break;
}
scanf("%s%s%s%s%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
p1->next = p2;
p2 = p1;
}
p1 = head;
while (p1->next!=NULL)
{
printf("%s %s %s %s %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1 = p1->next;
}
printf("%s %s %s %s %s %s",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->add);
return 0;
}
|
31
|
15125
|
struct student
{
char number[100];
char name[100];
char sex;
int age;
char score[100];
char address[100];
struct student *prev;
struct student *next;
};
int main()
{
struct student *phead,*p,*q;
char m[10];
phead=(struct student*)malloc(sizeof(struct student));
phead->prev=NULL;
scanf("%s",m);
q=phead;
do
{
p=(struct student*)malloc(sizeof(struct student));
strcpy(p->number, m);
scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,&p->score,p->address);
p->prev=q;
q->next=p;
q=q->next;
scanf("%s",m);
} while (strcmp(m,"end")!=0);
q->next=NULL;
p=phead;
while (p->next!=NULL) p=p->next;
while (p!=phead)
{
printf("%s %s %c %d %s %s\n",p->number,p->name,p->sex,p->age,p->score,p->address);
p=p->prev;
}
}
|
31
|
15126
|
struct student
{
char str[100];
struct student *next;
};
int n;
char end[5]="end";
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
gets(p1->str);
head=null;
while(strcmp(p1->str,end)!=0)
{
n=n+1;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->str);
}
p2->next=null;
return(head);
}
void main()
{
struct student *p1,*p2,*p3,*head;
head=creat();
p1=head;
p2=p1->next;
p3=p2->next;
while(p3!=null)
{
p2->next=p1;
p1=p2;
p2=p3;
p3=p2->next;
}
p2->next=p1;
head->next=null;
do
{
printf("%s\n",p2->str);
p2=p2->next;
}
while(p2!=null);
}
|
31
|
15127
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
char score[50];
char add[20];
struct student *before;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
p1=(struct student* )malloc(len);
p1->before=NULL;
p2=p1;
do
{
scanf("%s",p1->num);
if(p1->num[0]=='e')
{
head=p2;
free(p1);
return(head);
}
else
{
scanf("%s %c %d %s",p1->name,&p1->sex,&p1->age,p1->score);
scanf("%s",p1->add);
p2=p1;
p1=(struct student*)malloc(len);
p1->before=p2;
}
}
while(1);
}
void main()
{
struct student *head1=creat();
struct student *q=head1;
while(q!=NULL)
{ printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->add);
q=q->before;
}
}
|
31
|
15128
|
int n;
struct student
{
char a[30];
char name[20];
char sex[20];
char age[20];
char score[20];
char addr[30];
struct student *next;
}
*creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*) malloc(len);
scanf("%s%s%s%s%s%s",p1->a,p1->name,p1->sex,p1->age,p1->score,p1->addr);
head=NULL;
while(strcmp(p1->a,"end")!=0)
{ n++;
if (n==1) p1->next=NULL;
else
p1->next=p2;
head=p1;
p2=p1;
p1=(struct student*)malloc(len);
scanf("%s%s%s%s%s%s",p1->a,p1->name,p1->sex,p1->age,p1->score,p1->addr);
}
return(head);
}
void print(struct student*head)
{
struct student *p1;
p1=head;
if(head!=NULL)
do
{
printf("%s %s %s %s %s %s\n",p1->a,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->next;
}while(p1!=NULL);
}
main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15129
|
struct student
{
char number[20];
char name[20];
char sex;
int age;
float grade;
char address[20];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p1,*p2;
head=p1=p2=(struct student *)malloc(LEN);
scanf("%s %s %c %d %f %s",p1->number,p1->name,&p1->sex,&p1->age,&p1->grade,p1->address);
p2->next=NULL;
for(n=0;;n++)
{
p1=(struct student *)malloc(LEN);
p1->next=p2;
scanf("%s",p1->number);
if(strcmp(p1->number,"end")==0)break;
scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->address);
p2=p1;
head=p1;
}return head;
}
void main()
{
struct student *head,*p;
head=creat();
p=head;
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->number,p->name,p->sex,p->age,p->grade,p->address);
p=p->next;
}
}
|
31
|
15130
|
struct student
{
char information[50];
struct student *next;
};
int main()
{
struct student *create_and_reverse();
void print(struct student *head);
struct student *head;
head=create_and_reverse();
print(head);
return 0;
}
struct student *create_and_reverse()
{
struct student *p1,*p2,*head;
char end[50]={'e','n','d'};
p1=(struct student *)malloc(len);
p2=p1;
gets((p1->information));
for(;;)
{
p1=(struct student *)malloc(len);
gets((p1->information));
if(strcmp(p1->information,end))
{
(p1->next)=p2;
}
else
{
head=p2;
break;
}
p2=p1;
}
return (head);
}
void print(struct student *head)
{
struct student *p;
p=head;
for(;;)
{
printf("%s\n",p->information);
if((p->next)==NULL)
{
break;
}
else
{
p=(p->next);
}
}
}
|
31
|
15131
|
int n=0;
struct student
{
char num[20];
char name[20];
char sex;
char age[20];
char score[20];
char ad[20];
struct student *next;
};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
p1=p2=(struct student *)malloc(LEN);
head=NULL;
scanf("%s ",p1->num);
if(p1->num[0]=='e')
return(head);
scanf("%s %c %s %s %s",p1->name,&p1->sex,p1->age,p1->score,p1->ad);
p1->next=NULL;
for(;;)
{
n=n+1;
head=p1;
if(n>1)
p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)
{
p1=NULL;
break;
}
scanf("%s %c %s %s %s",p1->name,&p1->sex,p1->age,p1->score,p1->ad);
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15132
|
struct student
{
char num[12];
char name[25];
char sex;
int age;
char score[6];
char add[12];
}stu[max];
int main()
{
int i,n,j;
for(i=0;;i++)
{
scanf("%s",stu[i].num);
if(stu[i].num[0]=='e')
{
break;
}
else
scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
}
if(i==0)
printf("\n");
else
{
for(j=i-1;j>=0;j--)
printf("%s %s %c %d %s %s\n",stu[j].num,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add);
}
return 0;
}
|
31
|
15133
|
struct student
{
char info[100];
struct student *next;
struct student *former;
};
int main()
{
struct student *head,*tail,*p;
char s[100];
p=(struct student*)malloc(sizeof(struct student));
gets(p->info);
head=p;
head->former=NULL;
tail=p;
while (strcmp(p->info,"end")!=0)
{
p=(struct student*)malloc(sizeof(struct student));
gets(p->info);
tail->next=p;
p->former=tail;
tail=p;
}
while (p->former!=NULL)
{
p=p->former;
printf("%s\n",p->info);
}
return 0;
}
|
31
|
15134
|
int l;
struct students
{
char num[10];
char name[20];
char sex;
int age;
float score;
char addr[100];
struct students *next;
};
struct students *ann()
{
struct students *head=NULL,*newnode,*p;
int i;
for(i=0;;i++)
{
newnode=(struct students *)malloc(sizeof(struct students));
scanf("%s",newnode->num);
if(newnode->num[0]=='e')
{
l=i;
head=p;
break;
}
scanf("%s %c %d %f %s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->addr);
if(i==0)
{
newnode->next=NULL;
p=newnode;
}
else
{
newnode->next=p;
p=newnode;
}
}
return(head);
}
void main()
{
int i;
struct students *p;
p=ann();
for(i=0;i<l;i++)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->next;
}
}
|
31
|
15135
|
struct student
{
char str[100];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
p1=p2=(struct student *)malloc(LEN);
gets(p1->str);
p1->next=NULL;
p2=p1;
while(strcmp(p2->str,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else {head=p2;p1=p2;}
p2=(struct student *)malloc(LEN);
p2->next=p1;
gets(p2->str);
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
while(p->next!=NULL)
{
puts(p->str);
p=p->next;
}
puts(p->str);
}
void main()
{
struct student *ip;
ip=creat();
print(ip);
}
|
31
|
15136
|
char m[]="end";
struct student
{
char studen[100];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p1,*p2;
n=0;
p1=p2=(struct student *)malloc(sizeof(struct student));
gets(p1->studen);
head=NULL;
while(strcmp(p1->studen,m)!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->studen);
}
p2->next=NULL;
return(head);
}
void print(struct student *head)
{
struct student *p,*q;
p=q=head;/*p,q???????????*/
while(p->next!=NULL)
p=p->next;/*?p??????????????*/
printf("%s\n",p->studen);
while(1)
{
while(q->next!=p)
q=q->next;
printf("%s\n",q->studen);
p=q;
q=head;
if(p==head)
break;
}
}
int main()
{ struct student *ahead;
ahead=creat();
print(ahead);
}
|
31
|
15137
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
float score;
char adr[15];
struct student *last;
};
char str[]="end";
int n=0;
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr);
p=p->last;
}while(p!=NULL);
}
void main()
{
struct student *creat(void);
void print(struct student *head);
struct student *head;
head=creat();
print(head);
}
struct student *creat()
{
struct student *head;
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
scanf("%s",&p1->num);
head=NULL;
while(strcmp(p1->num,str)!=0)
{
scanf("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr);
if(n==0){p1->last=NULL;n=1;}
else {p1->last=p2;}
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",&p1->num);
}
head=p2;
return(head);
}
|
31
|
15138
|
struct student
{
char num[20],na[30],sex[2],sc[10],old[3],ad[20];
struct student *next;
};
int n;
void main()
{
struct student *head,*p1,*p2,*p;
n=0;
p1=p2=(struct student *)malloc(LEN);
head=NULL;
while(scanf("%s",p1->num),p1->num[0]!='e')
{
n=n+1;
head=p1;
if(n>1)
p1->next=p2;
else
p1->next=NULL;
p2=p1;
scanf("%s%s%s%s%s",p1->na,p1->sex,p1->old,p1->sc,p1->ad);
p1=(struct student *)malloc(LEN);
}
p=head;
while(p!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->na,p->sex,p->old,p->sc,p->ad);
p=p->next;
};
}
|
31
|
15139
|
struct student
{
char str[100];
struct student *next;
struct student *front;
};
struct student *create()
{
struct student *head,*pf,*pa,*end;
int n=1,flag=0;
do
{
pa=(struct student *) malloc(LEN);
gets(pa->str);
if(strcmp(pa->str,"end")==0)
{
if(n==1) flag=1;
break;
}
if(n==1)
{
head=pa;
pf=pa;
pa->front=NULL;
n++;
}
else
{
pf->next=pa;
pa->front=pf;
pf=pa;
}
}while(n!=0);
if(flag==0){pf->next=NULL;
end=pf;}
else{head=pa; end=NULL;}
return(end);
}
int main()
{
struct student *end,*pt;
end=create();
pt=end;
while(pt!=NULL)
{
printf("%s\n",pt->str);
pt=pt->front;
}
return 0;
}
|
31
|
15140
|
struct student//?????????????????
{
char num[100];
char name[100];
char gender;
int age;
float grade;
char address[100];
struct student *next;
} ;
struct student *p1,*p2;
struct student *creat()//????????
{
int n;
struct student *head;
n=0;
p1=p2=(struct student *)malloc(LEN);//???????*????????????????
scanf("%s %s %c %d %f %s",p1->num,p1->name,&p1->gender,&p1->age,&p1->grade,p1->address);
head=NULL;
while(strcmp(p1->num,"end")!=0)//????
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")!=0)
scanf("%s %c %d %f %s\n",p1->name,&p1->gender,&p1->age,&p1->grade,p1->address);
}
p2->next=NULL;
return(head);
}
void print(struct student *head)//????
{
struct student *p1;
for(p1=head; p1!=NULL; printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->gender,p1->age,p1->grade,p1->address),p1=p1->next);
}
//?????
struct student * turnback(struct student *head)
{
struct student *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;
else new=new->next=p2;
p2->next=NULL;
}
while(head->next!=NULL);
return(newhead);
}
void main()
{
struct student *head;
head=creat();
head=turnback(head);
print(head);
}
|
31
|
15141
|
struct stu
{
char num[500];
char name[500];
char sex[2];
char age[100];
char score[100];
char add[500];
struct stu *next;
};
int n;
struct stu *tj(void)
{
struct stu *head;
struct stu *p1,*p2;
n=0;
p2=p1=(struct stu*)malloc(LEN);
scanf("%s %s %s %s %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
head=NULL;
while(1)
{
n=n+1;
if(n==1)
head=p1;
else
p1->next=p2;
p2=p1;
p1=(struct stu*)malloc(LEN);
scanf("%s",&p1->num);
if(strcmp(p1->num,"end")==0)
break;
scanf("%s %s %s %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
}
head=p2;
return(head);
}
void print(struct stu *head)
{
struct stu *p;
p=head;
while(p!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}
}
void main()
{
struct stu *z;
z=tj();
print(z);
}
|
31
|
15142
|
struct st /*????????????*/
{
char id[20];
char name[20];
char sex[2];
int age;
char sco[20];
char ad[20];
struct st *next;
};
main()
{
struct st *head,*p1,*p2,*p;
p1 = p2 = (struct st*)malloc(len); /*???p1,p2?????????????*/
scanf("%s%s%s%d%s%s",p1->id,p1->name,p1->sex,&p1->age,p1->sco,p1->ad);
p2->next = null; /*????????????????????*/
do /*??????*/
{
p1 = (struct st*)malloc(len); /*???????*/
scanf("%s",p1->id); /*????????????id???*/
if (strcmp(p1->id,"end") == 0) /*???end'???????*/
{
break;
}
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->sco,p1->ad);
p1->next = p2; /*????????????*/
p2 = p1; /*?p2?????*/
}
while (1);
head = p2; /*?????????????????????*/
p = head;
do /*???????????????????*/
{
printf("%s %s %s %d %s %s\n",p->id,p->name,p->sex,p->age,p->sco,p->ad);
p = p->next; /*???????????*/
}
while(p != null);
return 0;
}
|
31
|
15143
|
struct student
{
char name[100];
struct student *next;
};
int main()
{
struct student *head,*p1,*p2;int i=0,j=0,m=0,k=0,n;
p1=(struct student *)malloc(Len);
scanf("%s",p1->name);
p1->next=NULL;head=p1;
for(;strcmp(p1->name,"end")!=0;i++)
{
p2=p1;
p1=(struct student*)malloc(Len);
scanf("%s",p1->name);
p1->next=NULL;
p2->next=p1;
p2=p1;
}
struct student *p; p=head; j=0;n=i/6;
for(m=1;m<=n;m++)
{ p=head;j=0;
while(p&&j!=i-6*m)
{
p=p->next;
j++;
}
if(p&&(j==i-6*m))
{
for(k=0;k<5;k++)
{
printf("%s ",p->name);p=p->next;
}
printf("%s",p->name);
}
printf("\n");
}
}
|
31
|
15144
|
void main()
{
struct st
{
char num[500];
char name[500];
char sex;
int age;
double mark;
char adress[500];
struct st *next;
}*p,*p1,*p2;
p2=NULL;
while(1)
{ p1=(struct st*)malloc(sizeof(struct st));p1->next=p2;p2=p1;
scanf("%s",p1->num);if(strcmp("end",p1->num)==0){p=p1->next;break;}
scanf("%s %c %d %lf %s",p1->name,&p1->sex,&p1->age,&p1->mark,p1->adress);
}
while(p!=NULL)
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->mark,p->adress);
p=p->next;
}
}
|
31
|
15145
|
struct student
{
char num[20];
char name[40];
char sex[10];
int age;
char score[20];
char addr[100];
struct student *next;
};
main()
{
struct student *head,*p1,*p;
int n=0;
p1=( struct student*) malloc(LEN);
scanf("%s%s%s%d%s%s",p1->num,p1->name,p1->sex,&p1->age,p1->score,p1->addr);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{
n=n+1;
if(n==1) {head=p1;p1->next=NULL;}
else {p1->next=head;head=p1;}
p1=(struct student*)malloc(LEN);
scanf("%s%s%s%d%s%s",p1->num,p1->name,p1->sex,&p1->age,p1->score,p1->addr);
}
p=head;
do
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->next;
} while(p!=NULL);
}
|
31
|
15146
|
struct stu
{
char num[9];
char name[18];
char sex[2];
int age;
float score;
char addr[12];
struct stu *pre;
};
struct stu *create()
{
struct stu *head,*p1,*p2;
char end[]={"end"};
p1=(struct stu *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,end)==0)
{
return p1;
}
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->addr);
p1->pre=NULL;
p2=p1;
while(1)
{
p1=(struct stu *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,end)==0)
{
return p2;
}
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->addr);
p1->pre=p2;
p2=p1;
}
}
void print(struct stu *head)
{
struct stu *p1;
p1=head;
while(p1)
{
printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
p1=p1->pre;
}
}
void destroy(struct stu *head)
{
struct stu *p1;
while(head)
{
p1=head;
head=p1->pre;
free(p1);
}
}
int main()
{
struct stu *head;
head=create();
print(head);
destroy(head);
return 0;
}
|
31
|
15147
|
struct student
{
char ID[20];
char name[20];
char sex;
int age;
char score[20];
char address[20];
struct student *next;
struct student *before;
};
struct student *create()
{
struct student *head,*p1,*p2,*end;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;end=NULL;}
else
{
head=p1;
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p1->next=NULL;
p1->before=NULL;
p2=p1;
do
{
p1=(struct student*)malloc(LEN);
p1->before=p2;
p1->next=NULL;
scanf("%s",p1->ID);
if(strcmp(p1->ID,"end")==0){p2->next=NULL;end=p2;free(p1);break;}
else
{
scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
p2->next=p1;
p1->before=p2;
p1->next=NULL;
p2=p1;
}
}while(1);
}
return(end);
}
void print(struct student *end)
{
struct student *p;
p=end;
while(p)
{printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address);
p=p->before;
}
}
int main()
{
struct student *end;
end=create();
print(end);
}
|
31
|
15148
|
struct student
{
char number[30];
char name[20];
char sex;
int age;
char score[30];
char address[20];
struct student *next;
};
main()
{
struct student *head,*end,*p,*q,*a;
head=(struct student*)malloc(sizeof(struct student));
end=(struct student*)malloc(sizeof(struct student));
int i,n;
end->next=NULL;
a=head;
for(i=1;;i++)
{
if(i==1)
{
p=(struct student*)malloc(sizeof(struct student));
scanf("%s",p->number);
if(p->number[0]=='e') break;
scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,p->score,p->address);
head->next=p;
p->next=end;
q=p;
}
else
{
p=(struct student*)malloc(sizeof(struct student));
scanf("%s",p->number);
if(p->number[0]=='e') break;
scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,p->score,p->address);
head->next=p;
p->next=q;
q=p;
}
}
a=head->next;
for(;a->next!=NULL;)
{
printf("%s %s %c %d %s %s\n",a->number,a->name,a->sex,a->age,a->score,a->address);
a=a->next;
}
}
|
31
|
15149
|
struct student
{
char id[20];
char name[20];
char sex;
int age;
char score[20];
char addr[20];
struct student *next;
};
int n;
struct student *head;
struct student *creat(void)
{
struct student *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);
scanf("%s",p1->id);
}
p2->next=NULL;
return(head);
}
void main()
{
head=creat();
struct student *p,*p0;
p=(struct student *)malloc(100*LEN);
p0=(struct student *)malloc(LEN);
p0=head;
int i;
for(i=0;i<n;i++,p++)
{
*p=*p0;
p0=p0->next;
}
p--;
printf("%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr);
p--;
for(i=1;i<n;i++,p--)
printf("\n%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr);
}
|
31
|
15150
|
struct student
{
struct student *pre;
char num[100];
char name[20];
char sex[2];
char age[10];
char score[10];
char ad[100];
};
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;
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
|
15151
|
struct a
{
struct a*back;
char a[20];
char b[20];
char c;
int d;
char e[20];
char f[20];
struct a*next;
};
int main()
{
struct a *pHeader,*pEnd,*p1;
pHeader=(struct a*)malloc(sizeof(struct a));
pHeader->back=NULL;
p1=pHeader;
struct a*p;
char g;
for(;;)
{
p=(struct a*)malloc(sizeof(struct a));
scanf("%s",p->a);
g=*p->a;
if(g=='e')
{
pEnd=p;
p->back=p1;
p1->next=p;
p->next=NULL;
break;
}
p->back=p1;
p1->next=p;
p1=p;
scanf("%s %c %d %s %s",p->b,&p->c,&p->d,&p->e,p->f);
}
printf("%s %s %c %d %s %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
p=pEnd;
for(;;)
{
printf("%s %s %c %d %s %s\n",p1->back->a,p1->back->b,p1->back->c,p1->back->d,p1->back->e,p1->back->f);
p1=p1->back;
free(p1->next);
if(p1->back->back==NULL) break;
}
}
|
31
|
15152
|
struct student
{
char num[20];
char name[20];
char sex[20];
char age[20];
char score[20];
char add[20];
struct student *next;
};
int n;
void main()
{
int i;
struct student *head,*p1,*p2,*newhead,*new;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)//built link;
{
scanf("%s%s%s%s%s",p1->name,p1->sex,p1->age,p1->score,p1->add);
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
}
p2->next=NULL;
for(i=0;i<n;i++)
{
p2=p1=head;
while(p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(i==0)newhead=new=p1;
else new=new->next=p1;
p2->next=NULL;
}
p1=newhead;
for(i=0;i<n;i++)
{
printf("%s %s %s %s %s %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
p1=p1->next;
printf("\n");
}
}
|
31
|
15153
|
struct student
{
char inf[1000];
struct student *pre,*next;
};
void main()
{
struct student *head,*p1,*p2,*tail;
int i,j,k;
head=(struct student *)malloc(LEN);
p1=head;p2=NULL;
p1->pre=NULL;p1->next=NULL;
for(;;)
{
gets(p1->inf);
if (strcmp(p1->inf,"end")==0) {p1->pre=p2;tail=p2;break;}
else
{
p1->pre=p2;
p1->next=(struct student *)malloc(LEN);
p2=p1;p1=p1->next;p1->next=NULL;
}
}
p1=tail;
while (p1)
{
puts(p1->inf);
p1=p1->pre;
}
}
|
31
|
15154
|
struct node{
char str[MAX];
struct node *next;
}*head;
void main()
{
struct node *p1,*p2,*p;
p1=p2=(struct node *)malloc(LEN);
gets(p1->str);
p1->next=0;
while(strcmp( p1->str , "end" )!=0){
p1=(struct node *)malloc(LEN);
gets(p1->str);
p1->next=p2;
head=p2;
p2=p1;
}
p=head;
while(p!=0){
puts(p->str);
p=p->next;
}
}
|
31
|
15155
|
int main()
{
struct student
{
char num[20];
char name[20];
char sex;
int age;
float mark;
char address[20];
struct student *next;
struct student *pre;
};
struct student *stu;
stu=(struct student*)malloc(LEN);
stu->pre=NULL;
while (1)
{
scanf ("%s",stu->num);
if (strcmp(stu->num,"end")==0)
break;
scanf ("%s %c %d %f %s",stu->name,&stu->sex,&stu->age,&stu->mark,stu->address);
stu->next=(struct student*)malloc(LEN);
stu->next->pre=stu;
stu=stu->next;
}
stu=stu->pre;
free(stu->next);
for ( ;stu!=NULL; )
{
printf("%s %s %c %d %g %s\n",stu->num,stu->name,stu->sex,stu->age,stu->mark,stu->address);
stu=stu->pre;
if (stu!=NULL)
free (stu->next);
}
return 0;
}
|
31
|
15156
|
struct st
{
char id[20];
char name[20];
char sex;
int age;
float goal;
char address[20];
struct st *last;
};
struct st *input(void)
{
int n;
struct st *end,*p1,*p2;
n=0;
p1=p2=(struct st *)malloc(sizeof(struct st));
scanf("%s",p1->id);
while(strcmp(p1->id,"end")!=0)
{
scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->goal,p1->address);
if(n==0) p1->last=NULL;
else p1->last=p2;
p2=p1;
p1=(struct st *)malloc(sizeof(struct st));
scanf("%s",p1->id);
n=1;
}
end=p2;
return(end);
}
void output(struct st *end)
{
struct st *p;
p=end;
if(end!=NULL)
do
{
printf("%s %s %c %d ",p->id,p->name,p->sex,p->age);
if(floor(p->goal)==p->goal) printf("%.0f",p->goal);
else printf("%.1f",p->goal);
printf(" %s\n",p->address);
p=p->last;
}while(p!=NULL);
}
int main()
{
struct st *end;
end=input();
output(end);
}
|
31
|
15157
|
struct stu
{
char xh[10];
char name[20];
char xb;
int age;
char score[20];
char add[20];
struct stu *next;
};
struct stu *creat()
{
struct stu *head,*p1,*p2;
int n=0;
p1=p2=(struct stu *)malloc(sizeof (struct stu));
head=0;
while(strcmp(p1->xh,"end")!=0)
{
n++;
if(n==1)
{
p1->next=0;
head=p1;
}
else
{
p2=p1;
p1=(struct stu *)malloc(sizeof (struct stu));
p1->next=p2;
}
scanf("%s",&p1->xh);
if(strcmp(p1->xh,"end")==0)
{
head=p2;
break;
}
scanf(" %s %c %d %s %s",&p1->name,&p1->xb,&p1->age,&p1->score,&p1->add);
}
return (head);
}
void print(struct stu *head)
{
struct stu *p;
p=head;
while (p!=0)
{
printf("%s %s %c %d %s %s\n",p->xh,p->name,p->xb,p->age,p->score,p->add);
p=p->next;
}
}
void main()
{
struct stu *head;
head=creat();
print(head);
}
|
31
|
15158
|
struct student
{char a[88];
struct student *next;
};
struct student *creat(void)
{struct student *p1,*p2,*head;
p1=p2=(struct student *)malloc(LEN);
gets(p1->a);
p1->next=0;
while(strcmp(p1->a,"end")!=0)
{p2=p1;
p1=(struct student *)malloc(LEN);
gets(p1->a);
p1->next=p2;
}
head=p2;
return(head);
}
void print(struct student *head)
{struct student *p;
p=head;
while(p!=0)
{puts(p->a);
p=p->next;}
}
void main()
{struct student *head;
head=creat();
print(head);
}
|
31
|
15159
|
struct student
{
char num[10];
char name[20];
char sex;
int age;
char score[10];
char id[20];
struct student *pre;
};
void main()
{
struct student *p1,*p2,*end;
p1=(struct student *)malloc(sizeof(struct student));
end=p1;
p2=p1;
p1->pre=NULL;
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->id);
for(;1;)
{
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0){end=p2;break;}
else scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->id);
p1->pre=p2;
p2=p1;
}
p1=end;
for(;p1!=NULL;)
{
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->id);
p1=p1->pre;
}
}
|
31
|
15160
|
struct student
{
struct student *next;
char num[20];
char name[20];
char sex[2];
int age;
float score;
char address[40];
};
struct student *creat()
{
struct student *head,*p1,*p2;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
if(strcmp(p1->num,"end")!=0)
{
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->address);
p2=p1;
p2->next=NUL;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0)
{
scanf("%s%s",p1->name,p1->sex);
scanf("%d%f%s",&p1->age,&p1->score,p1->address);
p1->next=p2;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%s",p1->num);
}
head=p2;
}
else
head=NUL;
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
while(p!=NUL)
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
p=p->next;
}
}
int main()
{
struct student *head;
head=creat();
print(head);
return 0;
}
|
31
|
15161
|
struct student //??????
{
char num[10]; //??
char name[20]; //??
char sex[5]; //??
int age; //??
char score[20]; //??
char addr[20]; //??
struct student *next;
};
struct student *head; //???????
struct student *input() //??????
{
struct student *p1,*p2;
p1=p2=(struct student *)malloc(sizeof(struct student)); //????????????
scanf("%s",p1->num); //????
p2->next=NULL; //??p2????
while(strcmp(p1->num,"end")!=0) //???????end??????????
{
scanf("%s",p1->name); //????
scanf("%s",p1->sex); //????
scanf("%d",&p1->age); //????
scanf("%s",p1->score); //????
scanf("%s",p1->addr); //????
p1=(struct student *)malloc(sizeof(struct student)); //??????????
scanf("%s",p1->num); //????
p1->next=p2; //p2????p1????????
p2=p1; //?p1?????p2
}
head=p1; //?????p1
return(head); //??
}
void print(struct student *head) //??????
{
struct student *p; //??????????????
p=head->next; //p?????????????
if(head!=NULL) //????????????
do
{
printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
p=p->next;
}
while(p!=NULL); //?p?????????????????????
}
main() //?????
{
input(); //??????
print(head); //??????
struct student *p1,*p2; //????????
p1=p2=head->next; //?p1?p2??????????
if(head!=NULL) //???????NULL???
do
{
p1=p2->next; //?p2?????????p1
free(p2); //??p2???
p2=p1; //?p1????p2
}
while(p2!=NULL); //?p2??NULL???
return 0; //??;
}
|
31
|
15162
|
struct stu
{
char num[100];
char name[100];
char sex[10];
int age;
char score[100];
char add[100];
struct stu *before;
};
void main()
{
struct stu *p2;
struct stu * f();
p2=f();
while (p2!=0)
{
printf("%s %s %s %d %s %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->add);
p2=p2->before;
}
}
struct stu * f()
{
struct stu *p1,*p2;
p1=(struct stu *)malloc(sizeof (struct stu));
p2=p1;
scanf("%s",p1->num);
p1->before=0;
if (strcmp(p1->num,"end")!=0)
{
do
{
p2=p1;
scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->score,p1->add);
p1=(struct stu *)malloc(sizeof (struct stu));
p1->before=p2;
scanf("%s",p1->num);
}
while (strcmp(p1->num,"end")!=0);
}
return p2;
}
|
31
|
15163
|
struct student
{
char str[1000];
struct student *next;
};
struct student *create(void)
{
struct student *head;
struct student *p1,*p,*p2;
head=p1=(struct student *)malloc(len);
gets(p1->str);
p1->next=0;
p2=p1;
while(strcmp(p1->str,"end")!=0)
{
p=head;
head=p1;
head->next=p;
p1=(struct student *)malloc(len);
gets(p1->str);
}
p2->next=0;
return(head);
}
void print(struct student *head)
{
struct student *p1;
p1=head;
if(head!=0)
do
{
puts(p1->str);
p1=p1->next;
}while(p1!=0);
}
void main()
{
struct student *head;
head=create();
print(head);
}
|
31
|
15164
|
struct shuju
{
char xh[20];
char xm[20];
char sex;
int age;
char fen[10];
char dorm[20];
struct shuju * next;
};
struct shuju *create()
{
struct shuju *head,*p1,*p2;
p1=(struct shuju* )malloc(len);
scanf("%s %s %c %d %s %s",p1->xh,p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
p1->next=NULL;
while (1)
{
p2=p1;
p1=(struct shuju* )malloc(len);
scanf("%s",p1->xh);
if (strcmp(p1->xh,"end")==0) {free(p1);break;}
else
{scanf("%s %c %d %s %s",p1->xm,&p1->sex,&p1->age,p1->fen,p1->dorm);
p1->next=p2;}
}
head=p2;
return (head);
}
void print(struct shuju* head)
{
struct shuju* p;
p=head;
while (p->next!=NULL)
{
printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
p=p->next;}
printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->sex,p->age,p->fen,p->dorm);
}
void main()
{
struct shuju *p;
p=create();
print(p);
}
|
31
|
15165
|
struct student
{
char num[100];
struct student *pNext;
};
int main()
{
int i,count=0;
struct student a[1000],*pheader,*p;
for(i=0;;i++)
{
gets(a[i].num);
count++;
if(strcmp(a[i].num,"end")==0)
break;
}
pheader=&a[count-2];
for(i=count-2;i>=1;i--)
{
a[i].pNext=&a[i-1];
}
a[0].pNext=NULL;
p=pheader;
while(p!=NULL)
{
puts(p->num);
p=p->pNext;
}
}
|
31
|
15166
|
struct student
{
char all[100];
struct student *next;
};
main()
{
int k;
int a=0;
struct student *p;
struct student *head;
struct student *p1,*p2;
p1=p2=(struct student *)malloc(n);
head=NULL;
k=0;
for(k=0;;k++)
{
gets(p1->all);
a++;
if((p1->all)[0]!='e')
{
if(a==1)
p1->next=NULL;
else
p1->next=p2;
p2=p1;
p1=(struct student *)malloc(n);
}
else
{
head=p2;
break;
}
}
p=head;
while(p!=NULL)
{
puts(p->all);
p=p->next;
}
}
|
31
|
15167
|
struct st
{
char id[10000];
struct st *next;
};
int main()
{
struct st *head=NULL,*p=NULL,*q=NULL;
char end;
while (1)
{
p=(struct st*)malloc(sizeof(struct st));
if(p!=NULL)
{
gets(p->id);
p->next=q;
if (p->id[0]=='e')
break;
else
q=p;
}
}
p=p->next;
while(1)
{
puts(p->id);
if (p->next==NULL)
break;
p=p->next;
}
}
|
31
|
15168
|
main()
{
struct INF {char a1[20];char a2[20];
char a3[20];char a4[20];char a5[20];
char a6[20];struct INF *pp;} *p1,*p2;
p1=(struct INF *)malloc(sizeof(struct INF));
p2=NULL;
int n=0,i;
scanf("%s",p1->a1);
while (strcmp(p1->a1,"end")!=0)
{ scanf("%s",p1->a2);
scanf("%s",p1->a3);
scanf("%s",p1->a4);
scanf("%s",p1->a5);
scanf("%s",p1->a6);
p1->pp=p2;
p2=p1;
p1=(struct INF *)malloc(sizeof(struct INF));
scanf("%s",p1->a1);
n++; }
for (i=0;i<n;i++)
{printf("%s %s %s %s %s %s\n",p2->a1,p2->a2,p2->a3,p2->a4,p2->a5,p2->a6);
p2=p2->pp;}
}
|
31
|
15169
|
struct student
{
char num[100];
char name[30];
char sex;
int age;
float grade;
char adress[30];
struct student *next;
struct student *before;
};
int n;
struct student *creat(void)
{
struct student *head,*end;
struct student *p1,*p2;
char str[5]={"end"};
n=0;
p1=p2=( struct student *)malloc(LEN);
scanf("%s %s %c %d %g %s",&p1->num,p1->name,&p1->sex,&p1->age,&p1->grade,p1->adress);
head=NULL;
do
{
n=n+1;
if(n==1) {head=p1;p1->before=NULL;}
else
{
p2->next=p1;
p1->before=p2;
}
p2=p1;
p1=( struct student *)malloc(LEN);
scanf("%s",&p1->num);
if(strcmp(p1->num,str)==0)
break;
scanf("%s %c %d %g %s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->adress);
}while(n<1000);
end=p2;
p2->next=NULL;
return (end);
}
void print(struct student *end)
{
struct student *p;
p=end;
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->adress);
p=p->before;
}while(p!=NULL);
}
void main()
{
struct student *end;
end=creat();
print(end);
}
|
31
|
15170
|
struct student
{
char num[20];
char name[20];
char sex[2];
int age;
float score;
char add[50];
struct student*next;
};
int n;
struct student*creat(void)
{
int juge=1;
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%s",p1->num);
scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
head=NULL;
while(1)
{
head=p1;
n=n+1;
if(n==1)
p1->next=NULL;
if(n>1)
{
p1->next=p2;
p2=p1;
head=p1;
}
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
juge=strcmp(p1->num,"end");
if(juge==0)break;
scanf("%s%s%d%f%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)
while(p!=NULL)
{
printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->next;
}
}
void main()
{
struct student *p;
p=creat();
print(p);
}
|
31
|
15171
|
struct info{
char num[10];
char name[20];
char sex;
int age;
float grade;
char address[10];
struct info *link;
};
int main(){
struct info *p1,*p2;
p1=p2=NULL;
p1=(struct info *)malloc(sizeof(struct info));
scanf("%s",p1->num);
if(p1->num[0]=='e') return 0;
do{
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->address);
p1->link=p2;
p2=p1;
p1=(struct info *)malloc(sizeof(struct info));
scanf("%s",p1->num);
}while(p1->num[0]!='e');
while(p2!=NULL){
printf("%s %s %c %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->grade,p2->address);
p1=p2->link;
p2=p1;
}
return 0;
}
|
31
|
15172
|
struct info
{
char id[30];
char name[30];
char gen;
int age;
float grade;
char add[30];
struct info *next;
};
int n;
struct info *creat(void)
{
struct info *head;
struct info *p1;
n=0;
head=p1=(struct info*)malloc(LEN);
scanf("%s",&p1->id);
while(strcmp(p1->id,"end"))
{ scanf("%s %c %d %f %s",&p1->name,&p1->gen,&p1->age,&p1->grade,&p1->add);
n=n+1;
if(n==1) {head=p1;p1->next=NULL;}
else p1->next=head;
head=p1;
p1=(struct info*)malloc(LEN);
scanf("%s",&p1->id);
};
return(head);
}
void print(struct info *head)
{
struct info *p;
p=head;
if(head!=NULL)
do
{
printf("%s %s %c %d %g %s\n",p->id,p->name,p->gen,p->age,p->grade,p->add);
p=p->next;
}while(p!=NULL);
}
void main()
{
struct info *head;
head=creat();
print(head);
}
|
31
|
15173
|
struct stu* create();
struct stu{
char text[100];
struct stu *prev;
};
int main()
{
struct stu *p;
p=create();
while (p){
printf("%s\n", p->text);
p = p->prev;
}
return 0;
}
struct stu* create(){
struct stu *p1,*p2,*start;
p1 = (struct stu *)malloc(sizeof(struct stu));
gets(p1->text);
if (p1->text == "end" ){
free(p1);
start = NULL;
return start; //?????
}
else{
p1->prev = NULL;
start = p1;
p2 = p1;
do{
p1 = (struct stu *)malloc(sizeof(struct stu));
start=p2;
gets(p1->text);
if ( strcmp(p1->text,"end")==0 ){
free(p1);
break;
}
else{
p1->prev = p2;
p2 = p1;
}
} while (1);
return start; //?????
}
}
|
31
|
15174
|
struct student
{
char num[16];
char a[64];
struct student *next;
};
int n;
struct student *creat(void)
{
struct student *head,*p,*q;
n=0;
p=q=(struct student *)malloc(len);
scanf("%s",p->num);
head=null;
while(strcmp(p->num,"end")!=0)
{
gets(p->a);
n++;
if(n==1)head=p,p->next=null;
else head=p,p->next=q;
q=p;
p=(struct student *)malloc(len);
scanf("%s",p->num);
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
int i;
for(i=0;i<n;i++)
{
printf("%s",p->num);
puts(p->a);
p=p->next;
}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15175
|
struct student
{char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
};
int main()
{int i=0,s=0;
int t=0;
struct student stu[1000];
scanf("%s",stu[0].num);
while(stu[i].num[0]!='e'){
scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
i++;
s++;
scanf("%s",stu[i].num);
}
for(i=s-1;i>=0;i--){
printf("%s %s %c %d %s %s\n",stu[i].num,stu[i].name,stu[i].sex,stu[i].age,stu[i].score,stu[i].add);
}
return 0;
}
|
31
|
15176
|
struct student
{
char c[100];
struct student*next;
};
struct student*creat()
{
struct student*p1,*p2,*p;
int i;
p1=p2=(struct student*)malloc(sizeof(struct student));
p=p1;
gets(p1->c);
while(strcmp(p1->c,"end")!=0)
{
p1=(struct student*)malloc(sizeof(struct student));
gets(p1->c);
if(strcmp(p1->c,"end")==0) break;
p2->next=p1;
p2=p1;
}
p2->next=NULL;
return p;
}
struct student*change(struct student*p)
{
struct student*p1,*p2,*p3;
p1=p;
p2=p;
p3=NULL;
while(p1->next!=NULL)
{
p2=p1->next;
p1->next=p3;
p3=p1;
p1=p2;
}
p1->next=p3;
return(p1);
}
void print(struct student*p)
{
struct student *p1,*p2;
p1=p;
while(p1!=NULL)
{
printf("%s\n",p1->c);
p1=p1->next;
}
}
void main()
{
struct student *p,*p1;
p=creat();
p=change(p);
print(p);
}
|
31
|
15177
|
struct stu
{
char inf[50];
struct stu *next;
} a[500];
int main()
{
// struct stu *head,*point;
int sum=0,i=0,j;
// point=(struct stu *)malloc(sizeof(struct stu));
while(gets(a[i].inf)!=NULL)
{
i++;
}
for(j=i-2;j>=0;j--)
{
puts(a[j].inf);
}
return 0;
}
|
31
|
15178
|
struct student
{
char num[20];
char name[20];
char sex;
int age;
char grade[20];
char address[20];
struct student *next;
};
struct student stud[200];
struct student * input()
{
struct student *head,*p;
head=NULL;
p=(struct student *)malloc(LEN);
scanf("%s",p->num);
while(strcmp(p->num,"end")!=0)
{
scanf("%s %c %d %s %s",p->name,&p->sex,&p->age,p->grade,p->address);
p->next=head;
head=p;
p=(struct student *)malloc(LEN);
scanf("%s",p->num);
}
return(head);
}
void output(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->grade,p->address);
p=p->next;
}
}
main()
{
struct student *head;
head=input();
output(head);
return 0;
}
|
31
|
15179
|
struct student
{
char message[300];
struct student *next;
};
int n;
struct student *creat(void)
{struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->message);
head=NULL;
while(strcmp(p1->message,"end")!=0)
{
n=n+1;
if(n==1)head=p1;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->message);
}
head->next=NULL;
return(p2);
}
void print(struct student *head)
{
struct student*p;
p=head;
if(head!=NULL)
do
{
printf("%s\n",p->message);
p=p->next;
}
while(p!=NULL);
}
void main()
{
struct student *head;
head=creat();
print(head);
}
|
31
|
15180
|
struct student{
char num[100];
char name[100];
char sex;
int old;
float score;
char add[150];
struct student *next;
};
void main()
{
struct student *p1,*p2;
int len=sizeof(struct student);
p1=(struct student *)malloc(len);
p1->next=NULL;
scanf("%s",p1->num);
while(strcmp(p1->num,"end")!=0){
scanf("%s %c %d %g %s",p1->name,&p1->sex,&p1->old,&p1->score,p1->add);
p2=p1;
p1=(struct student *)malloc(len);
p1->next=p2;
scanf("%s",p1->num);
}
while(p1->next!=NULL){
p1=p1->next;
printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->old,p1->score,p1->add);
}
}
|
31
|
15181
|
struct student
{
char inf[1000];
struct student *pNext;
};
int main()
{
int i,j,k,l,m,n;
int count=0;
struct student a[1000],*pHeader,*p;
for(i=0;;i++)
{
gets(a[i].inf);
count=count+1;
if(strcmp(a[i].inf,"end")==0)
break;
}
pHeader=&a[count-2];
for(i=count-2;i>=1;i--)
{
a[i].pNext=&a[i-1];
}
a[0].pNext=NULL;
p=pHeader;
while(p!=NULL)
{
puts(p->inf);
p=p->pNext;
}
}
|
31
|
15182
|
struct student
{
char a[100];
struct student *next;
};
int main()
{
struct student *p1,*p2;
p1=(struct student*)malloc(len);
p1->next=NULL;
gets(p1->a);
while((strcmp(p1->a,"end"))!=0)
{
p2=p1;
p1=(struct student*)malloc(len);
p1->next=p2;
gets(p1->a);
}
p1=p1->next;
while(p1!=NULL)
{
printf("%s\n",p1->a);
p1=p1->next;
}
return 0;
}
|
31
|
15183
|
struct stu
{char num[9];
char nam[50];
char s;
int old;
double sco;
char add[18];
struct stu *next;
struct stu *abv;
};
void main()
{struct stu*head,*p1,*p2;
int i=0;
head=NULL;
do
{p1=(struct stu*)malloc(LEN);
scanf("%s",&p1->num);if(!strcmp(p1->num,"end"))break;
scanf("%s %c %d %lf %s",&p1->nam,&p1->s,&p1->old,&p1->sco,&p1->add);
if(i==0){head=p1;p1->abv=NULL;}
else {p1->abv=p2;}
p2=p1;
i++;
}while(1);
p1=p2;
do
{if(p1->sco-(int)p1->sco==0)
printf("%s %s %c %d %.0lf %s\n",p1->num,p1->nam,p1->s,p1->old,p1->sco,p1->add);
else
printf("%s %s %c %d %.1lf %s\n",p1->num,p1->nam,p1->s,p1->old,p1->sco,p1->add);
p1=p1->abv;
}while(p1!=NULL);
}
|
31
|
15184
|
int n;
struct student{char stu[50];struct student *next;};
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->stu);
head=NULL;
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);
}
struct student *reverse(struct student *head)
{
struct student *p1,*p2,*p3;
p2=head;p3=head->next;
do
{
p1=p2;p2=p3;p3=p2->next;p2->next=p1;
}while(p3!=NULL);
head->next=NULL;
return(p2);
}
void print(struct student *head)
{
struct student *p;
p=head;
if(head!=NULL)
while(p)
{
if(p->stu!="end")
printf("%s\n",p->stu);
p=p->next;
}
}
int main()
{
struct student *head;
head=creat();
head=reverse(head);
print(head);
return 0;
}
|
31
|
15185
|
struct student
{
char num[100];
char name[100];
char gender[2];
char age[100];
char score[100];
char add[100];
struct student *next;
};
struct student *creat(void)
{
struct student *head,*p1;
head=NULL;
while(1)
{
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
p1->next=head;
if(strcmp(p1->num,"end")==0)
break;
scanf("%s%s%s%s%s",p1->name,p1->gender,p1->age,p1->score,p1->add);
head=p1;
}
return(head);
}
void print(struct student *head)
{
struct student *p;
p=head;
while(p!=NULL)
{
printf("%s %s %s %s %s %s\n",p->num,p->name,p->gender,p->age,p->score,p->add);
p=p->next;
}
}
void main()
{
struct student *po;
po=creat();
print(po);
}
/*??????????????????????????????????????
????
?????????????????????
00630018 zhouyan m 20 10.0 28#460
??????"end"??
????
????????
?? ?? ?? ?? ?? ??
???????
????
00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
end
????
10630018 zouan m 20 10 28#46000
0630018 zuyan m 21 100 28#4600
01030018 houyan m 20 10 28#4600
00160018 zouyan f 21 100 28#4600
00613018 zhuyan m 20 100 28#4600
0063018 zhouan m 21 10000 28#4600000
0063008 zhoyan f 20 1000 28#460000
0063001 zhouyn f 21 100 28#460000
00630018 zhouyan m 20 10 28#4600*/
|
31
|
15186
|
struct student
{
char num[1000];
char name[1000];
char sex;
int age;
char score[1000];
char add[1000];
struct student*next;
struct student*pre;
};
int n;
struct student*creat()
{
struct student*head,*end;
struct student*p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
head=NULL;
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);
n=n+1;
if(n==1){head=p1;p1->pre=NULL;}
else {p2->next=p1;p1->pre=p2;}
p2=p1;
p1=(struct student*)malloc(LEN);
scanf("%s",p1->num);
}
p2->next=NULL;
end=p2;
return(end);
}
void print(struct student*end)
{
struct student*p;
p=end;
do
{
printf("%s %s %c %d %s %s",p->num,p->name,p->sex,p->age,p->score,p->add);
printf("\n");
p=p->pre;
}while(p!=NULL);
}
int main()
{
struct student *end;
end=creat();
print(end);
return 0;
}
|
31
|
15187
|
struct student
{
char info[100];
struct student *next;
struct student *former;};
int i,j,k,n;
void main()
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(len);
gets(p1->info);
head=0;
while(strcmp(p1->info,"end")!=0)
{
n=n+1;
if(n==1) {head=p1;
p1->former=0;}
else {p2->next=p1;
p1->former=p2;}
p2=p1;
p1=(struct student *)malloc(len);
gets(p1->info);
}
p2->next=0;
p1=p2;
do{
puts(p2->info);
printf("\n");
p2=p2->former;}
while(p2!=0);
}
|
31
|
15188
|
void main()
{
struct stu
{
char num[20];
char name[20];
char sex;
int age;
float score;
char addr[20];
struct stu*next;
}*p1,*p2;
p1=malloc(sizeof(struct stu));
scanf("%s",p1->num);
if(*p1->num!='e')
{
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
p1->next=0;
for(;;)
{
p2=p1;
p1=malloc(sizeof(struct stu));
scanf("%s",p1->num);
if(*p1->num=='e')break;
scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
p1->next=p2;
}
p1=p2;
for(;p1;p1=p1->next)printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
}
}
|
31
|
15189
|
struct student
{
char a[1000];
struct student *next;
};
void main()
{
struct student *head,*p1,*p2;
p1=head=(struct student*)malloc(LEN);
// scanf("%s %s %c %d %d %s",p1->num,p1->name,&p1->sex,&p1->age,
// &p1->score,p1->addr);
p1->next=NULL;
gets(p1->a);
while(strcmp(p1->a,"end"))
{
p2=(struct student*)malloc(LEN);
p2->next=p1;
p1=p2;
gets(p1->a);
}
while(p1->next!=NULL)
{
p1=p1->next;
printf("%s\n",p1->a);
}
}
|
31
|
15190
|
struct a {
char id[150];
struct a *pre;
};
struct a *creat(){
struct a *head, *p1, *p2;
p1=(struct a*)malloc(l);
gets(p1->id);
p1->pre=NULL;
p2=p1;
while(1){
p1=(struct a*)malloc(l);
gets(p1->id);
if (p1->id[0]=='e'){break;}
p1->pre=p2;
p2=p1;
}
free(p1);
head=p2;
return head;
}
void des(struct a *head){
struct a *p;
while(head){
p=head;
head=head->pre;
free(p);
}
}
int main (){
struct a *head, *p;
head=creat();
p=head;
while(p){
printf("%s\n", p->id);
p=p->pre;
}
des(head);
return 0;
}
|
31
|
15191
|
void myPrint()
{
char str[100];
gets(str);
if(strcmp(str,"end"))
myPrint();
else
return;
puts(str);
}
int main()
{
myPrint();
return 0;
}
|
31
|
15192
|
int num=0;
void main()
{
struct student
{
char xh[100];
char xm[100];
char xb;
int nl;
float df;
char dz[100];
struct student *af;
struct student *bf;
};
int i,j,k,m,n;
struct student *p1,*p2,*p3,*p4,*head;
p1=p2=(struct student *)malloc(sizeof(struct student));
scanf("%s %s %c %d %f %s",p1->xh,p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p1->bf=0;
while(strcmp(p2->xh,"end")!=0)
{
p1=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->xh);
if(strcmp(p1->xh,"end")==0)
{
head=p2;
p1->bf=p2;
p2->af=p1;
p2=p1;
num++;
p1->af=0;
break;
}
scanf("%s %c %d %f %s",p1->xm,&p1->xb,&p1->nl,&p1->df,p1->dz);
p1->bf=p2;
p2->af=p1;
p2=p1;
num++;
}
//if(strcmp(p1->xh,"end")==0)p1->af=0;
//printf("%d",num);
p1=head;
//printf("%c",p1->xb);
for(i=0;i<num;i++)
{
printf("%s %s %c %d %g %s\n",p1->xh,p1->xm,p1->xb,p1->nl,p1->df,p1->dz);
p1=p1->bf;
}
}
|
31
|
15193
|
struct student
{
char locate[100];
struct student *next;
struct student *last;
};
int n;
char u[100];
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->locate);
strcpy(u,p1->locate);
head=NULL;
while(strcmp(p1->locate,"end")!=0)
{n=n+1;
if(n==1){head=p1;}
else {p2->next=p1;p1->last=p2;}
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->locate);
}
p1->last=p2;
p2->next=NULL;
return(p2);
}
void main()
{
struct student *creat(void);
struct student *p;
p=creat();
do
{printf("%s\n",p->locate);
p=p->last;
}while(strcmp(p->locate,u)!=0);
printf("%s",p->locate);
}
|
31
|
15194
|
struct stu
{
char num[20];
char name[20];
char sex;
int age;
char grade[20];
char add[20];
struct stu *p;
};
int main ()
{
struct stu *p1,*p2;
p1=(struct stu*)malloc(sizeof(struct stu));
p1->p=NULL;
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
while(1)
{
p2=p1;
p1=(struct stu*)malloc(sizeof(struct stu));
p1->p=p2;
scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
if(p1->num[0]=='e')
break;
}
while(p1->p!=NULL)
{
p1=p1->p;
printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->grade,p1->add);
}
return 0;
}
|
31
|
15195
|
// ???????????????
struct record
{
char str[100];
};
struct YyxNode
{
struct record m_rec;
struct YyxNode *next;
};
struct YyxStack
{
int n;
struct YyxNode *top;
};
struct YyxStack *CreateNewStack()
{
struct YyxStack *newSt;
if((newSt=(struct YyxStack*)malloc(sizeof(struct YyxStack)))==NULL){
printf("Error: memory out! (1)\n");
exit(-1);
}
newSt->n = 0;
newSt->top = NULL;
return newSt;
}
struct YyxStack *Push(struct YyxStack *st, const struct record *rec)
{
struct YyxNode *newNode;
if((newNode=(struct YyxNode*)malloc(sizeof(struct YyxNode)))==NULL){
printf("Error: memory out! (2)\n");
exit(-1);
}
newNode->m_rec = *rec;
newNode->next = st->top;
st->top = newNode;
st->n ++;
return st;
}
struct YyxStack *Top(struct YyxStack *st, struct record *rec)
{
*rec = st->top->m_rec;
return st;
}
struct YyxStack *Pop(struct YyxStack *st)
{
struct YyxNode *delNode = st->top;
if (delNode==NULL)
return st;
st->top = delNode->next;
st->n --;
free(delNode);
return st;
}
struct YyxStack *ClearStack(struct YyxStack *st)
{
while(st->top!=NULL)
Pop(st);
return st;
}
int main()
{
struct YyxStack *mainSt;
struct record stu;
mainSt = CreateNewStack();
gets(stu.str);
while(strcmp(stu.str, "end")){
Push(mainSt, &stu);
gets(stu.str);
}
while(mainSt->n>0){
Pop(Top(mainSt, &stu));
puts(stu.str);
}
// free(ClearStack(mainSt));
return 0;
}
|
31
|
15196
|
struct student
{
char a[100];
struct student *next;
struct student *last;
};
struct student *creat(void)
{
struct student *head,*p1,*p2;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->a);
p1->last=NULL;
int i;
for(i=1;strcmp(p1->a,"end")!=0;i++)
{
if(i==1);
else {p2->next=p1;p1->last=p2;}
p2=p1;
p1=(struct student *)malloc(sizeof(struct student));
gets(p1->a);
}
p2->next=NULL;head=p2;
return(head);
}
main()
{
struct student *head,*p;
head=creat();
p=head;
int i;
for(i=0;p->last!=NULL;i++)
{
printf("%s\n",p->a);
p=p->last;
}
printf("%s",p->a);
}
|
31
|
15197
|
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);
getchar();
getchar();
getchar();
getchar();
}
|
31
|
15198
|
struct stu
{
char num[50];
char name[50];
char sex;
int age;
float score;
char add[50];
struct stu *forward;
};
void main()
{ int n=0;
struct stu *head,*p1,*p2;head=NULL;
p1=p2=(struct stu *)malloc(LEN);
while(1)
{
n++;
if(n==1){head=p1;head->forward=NULL;}
else {p1->forward=p2;}
scanf("%s",p1->num);
if(strcmp(p1->num,"end")==0)break;
scanf(" %s",p1->name);
scanf(" %c",&p1->sex);
scanf(" %d",&p1->age);
scanf(" %f",&p1->score);
scanf(" %s",p1->add);
p2=p1;
p1=(struct stu *)malloc(LEN);
}
struct stu *p;
p=p2;
if(p->forward!=NULL)
{
do
{
printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
p=p->forward;
}while(p!=NULL);
}
}
|
31
|
15199
|
struct student
{
char str[50];
struct student *next;
};
int n;
struct student *creat()
{
struct student *head, *temp, *end;
head = end = temp = (struct student*) malloc(LEN);
gets(temp->str);
while (temp->str[0] != 'e')
{
temp->next = head;
head = temp;
temp = (struct student*) malloc(LEN);
gets(temp->str);
}
end->next = NULL;
return (head);
}
void print(struct student *head)
{
struct student *p;
p = head;
while (p != NULL)
{
puts(p->str);
p = p->next;
}
}
void main()
{
struct student *head;
head = creat();
print(head);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.