琥珀玲珑
琥珀玲珑的世界,也是你们的世界哦。大家一起来吧!!!!

#include<stdio.h>
typedef struct student
{
 int num;
 float score;
 struct student *next;
}stu;                                             //命名了一个新的类型名代表结构体类型
void create()
{
 stu a,b,c,*head,*p;                         //a,b,c为三个链表的结点,head为头结点
 a.num=101;a.score=85.5;
 b.num=102;b.score=90.5;
 c.num=103;c.score=95;
 head=&a;
 a.next=&b;
 b.next=&c;
 c.next=NULL;
 p=head;                                  //使p指向头结点
 printf("学号     分数\n");
 do
 {
  printf("%d %9.1f\n",p->num,p->score);
  p=p->next;
 }while(p!=NULL);
}
int main()
{
 create();
 return 0;
}

posted on 2013-07-18 09:58  琥珀玲珑  阅读(94)  评论(0编辑  收藏  举报