include
include
include
typedef struct student
{
char name[1];
float score[1];
struct student next;
}STU;
STU *myCreatelist(STU *head)
{
STU *q,*p;
char temp[10];
int flag=1;
float t=0;
head=(STU)malloc(sizeof(STU));
head->next=NULL;
q=head;
while(flag)
{
p=(STU*)malloc(sizeof (STU));
p->next=NULL;
printf("input name\n");
scanf("%s",temp);
printf("input score\n");
strcpy(p->name,temp);
scanf("%f",&t);
p->score[0]=t;
q->next=p;
q=p;
printf("inpuut flag\n");
scanf("%d",&flag);
}
p=head->next;
while(p)
{
printf("name is :%s\n",p->name);
printf("score is :%.2f\n",p->score[0]);
p=p->next;
}
printf("\n");
return head;
}
void main ()
{
STU *head,*p,*q;
head=myCreatelist(head);
q=head->next;
while (q=q->next)
{
if(!strcmp (q->next->name,"x6"))
{
p=q->next;
q->next=p;
break;
}
}
p=head;
while (p=p->next)
{
printf("name is :%s\n",p->name);
printf("score is :%f\n",p->score[0]);
p=p->next;
}
}