#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
typedef struct student
{
char name[15];
float score;
struct student* next;
}SS;
int len = sizeof(SS);
int main()
{
SS* create(void);
SS* abcde(SS * h);
void print(SS *h);
print(abcde(create()));
return 0;
}
SS* create(void)
{
SS* head;
SS* p1, * p2;
p1 = p2 = (SS*)malloc(len);
scanf("%s %f", &p1->name, &p1->score);
head = p1;
while (p1->score != -1)
{
p2->next = p1;
p2 = p1;
p1 = (SS*)malloc(len);
scanf("%s %f", &p1->name, &p1->score);
}
p2->next = NULL;
return head;
}
SS* abcde(SS* h)
{
SS *p=h,*q,*t;
t=(SS *)malloc(len);
scanf("%s%f",t->name,&t->score);
t->next=NULL;
while(p!=NULL)
{
if(p->score>t->score)
{
if(p==h)
h=t;
else
q->next=t;
t->next=p;
break;
}
q=p;
p=p->next;
}
return h;
}
void print(SS *h)
{
while(h)
{
printf("%s %.1f\n",h->name,h->score);
h=h->next;
}
}