#include <stdio.h>
#include <stdlib.h>
typedef struct tagFdian
{
float f;
struct tagFdian *next;
}Fdian;
int main(int argc, const char * argv[])
{
Fdian *pre=NULL,*head=NULL,*temp;
for (int i=0; i<5; i++)
{
temp=malloc(sizeof(float));
printf("请输入第%d个浮点数:",i+1);
scanf("%f",&temp->f);
if (head==NULL)
{
head=temp;
}
if (pre!=NULL)
{
pre->next=temp;
}
pre=temp;
}
pre->next=NULL;
temp=head;
while (temp!=NULL)
{
printf("%f\t",temp->f);
temp=temp->next;
}
Fdian *p=head;
while (p)
{
Fdian *t=p->next;
free(p);
p=t;
}
return 0;
}