/*
* 程序的版权和版本声明部分
* Copyright (c)2012, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称: jiegouti.cpp
* 作 者:晓晨
* 完成日期:2013年3月8日
* 版本号: v1.0
* 输入描述:无
* 问题描述:无
# include <iostream>
using namespace std;
struct Student
{
long num;
float score;
struct Student *next;
};
int main()
{
Student *head=NULL,*p,*q;
for(int i=0;i<3;i++)
{
p=new Student;
cin>>p->num>>p->score;
p->next=NULL;
if(i==0)
head=p;
else
q->next=p;
q=p;
}
p=head;
while(p!=NULL)
{
cout<<p->num<<" "<<p->score<<endl;
p=p->next;
}
}
结果: