// 运用简单的静态链表;输出三个学生的学号和成绩。例如 1 85.2
// 2 63.2
// 3 85.5
#include<stdio.h>
struct Student
{
int num;
float score;
struct Student *next;
}a,b,c;
int main()
{
struct Student *p,*head;
a.num =1;
a.score =85.2;
b.num=2;
b.score =63.2;
c.num =3;
c.score =85.5;
printf("%d %5.1f\n",a.num ,a.score );
printf("%d %5.1f\n",b.num ,b.score );
printf("\"%d %5.1f\" \n",c.num ,c.score ); //引号的用
printf("\b");
printf("\n\n");
head=&a;
a.next =&b;
b.next =&c;
c.next =NULL;
p=head;
do
{
printf("%d %4.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}
// 2 63.2
// 3 85.5
#include<stdio.h>
struct Student
{
int num;
float score;
struct Student *next;
}a,b,c;
int main()
{
struct Student *p,*head;
a.num =1;
a.score =85.2;
b.num=2;
b.score =63.2;
c.num =3;
c.score =85.5;
printf("%d %5.1f\n",a.num ,a.score );
printf("%d %5.1f\n",b.num ,b.score );
printf("\"%d %5.1f\" \n",c.num ,c.score ); //引号的用
printf("\b");
printf("\n\n");
head=&a;
a.next =&b;
b.next =&c;
c.next =NULL;
p=head;
do
{
printf("%d %4.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}