#include<Windows.h>
struct?STU{
long?sno;
char?sname[8];
int?sage;
int?sclass;
struct?STU?*next;
};
int?*pi;
void?Print_slist_no(struct?STU?*h)
{
struct?STU?*p;
p=h->next;
if(p=='\0')
{
printf("Linklist?is?null!\n");
}
else
{
// printf("heead");
while(p!='\0')
{
printf("%d\t",p->sno);
p=p->next;
}
printf("end\n");
}
}
void?Print_slist_name(struct?STU?*h)
{
struct?STU?*p;
p=h->next;
if(p=='\0')
{
printf("Linklist?is?null!\n");
}
else
{
// printf("heead");
while(p!='\0')
{
printf("%d\t",p->sname);
p=p->next;
}
printf("end\n");
}
}
void?Print_slist_age(struct?STU?*h)
{
struct?STU?*p;
p=h->next;
if(p=='\0')
{
printf("Linklist?is?null!\n");
}
else
{
// printf("heead");
while(p!='\0')
{
printf("%d\t",p->sage);
p=p->next;
}
printf("end\n");
}
}
void?Print_slist_class(struct?STU?*h)
{
struct?STU?*p;
p=h->next;
if(p=='\0')
{
printf("Linklist?is?null!\n");
}
else
{
// printf("heead");
while(p!='\0')
{
printf("%d\t",p->sclass);
p=p->next;
}
printf("end\n");
}
}
void?Delete_STU_no(struct?STU?*h,int?x)
{
#define?PRO?sno
struct?STU?*p,*q;
q=h;p=h->next;
if(p!='\0')
{
while((p!='\0')&&(p->PRO!=x))
{
q=p;p=p->next;
}
if(p->PRO==x)
{
q->next=p->next;free(p);
}
}
#undef?PRO
}
void?Delete_STU_name(struct?STU?*h,int?x)
{
#define?PRO?sname
struct?STU?*p,*q;
q=h;p=h->next;
if(p!='\0')
{
while((p!='\0')&&(p->PRO!=x))
{
q=p;p=p->next;
}
if(p->PRO==x)
{
q->next=p->next;free(p);
}
}
#undef?PRO
}
void?Delete_STU_age(struct?STU?*h,int?x)
{
#define?PRO?sage
struct?STU?*p,*q;
q=h;p=h->next;
if(p!='\0')
{
while((p!='\0')&&(p->PRO!=x))
{
q=p;p=p->next;
}
if(p->PRO==x)
{
q->next=p->next;free(p);
}
}
#undef?PRO
}
void?Delete_STU_class(struct?STU?*h,int?x)
{
#define?PRO?sclass
struct?STU?*p,*q;
q=h;p=h->next;
if(p!='\0')
{
while((p!='\0')&&(p->PRO!=x))
{
q=p;p=p->next;
}
if(p->PRO==x)
{
q->next=p->next;free(p);
}
}
#undef?PRO
}
void?Insert_STU(struct?STU?*h,int?x,int?y)
{
struct?STU?*s,*p,*q;
s=(struct?STU?*)malloc(sizeof(struct?STU));
s->sage=y;
q=h;
p=h->next;
while((p!='\0')?&&?(p->sage!=x))
{
q=p;p=p->next;
}
q->next=s;s->next=p;
}
void?main()?
{
int?x;
struct?STU?*phead,*s,*r;
phead=(struct?STU*)malloc(sizeof(struct?STU));
r=phead;
scanf("%d",&x);
while(x>=0)
{
s=(struct?STU*)malloc(sizeof(struct?STU));
s->sage=x;
r->next=s;
scanf("%d",&x);
}
r->next='\0';
Print_slist_no(s);
Print_slist_name(s);
Print_slist_age(s);
Print_slist_class(s);
}