//Ex4_17.cpp
#include "iostream" 
#include "cstring"
#include "iomanip"
using namespace std;
void main( )
{struct item
	{int num;
     item *next;
	};
 item *head=NULL,*temp;  //初始表头为NULL 
 int stno;
 cout<<"Enter students' numbers,-1 to stop:"<<endl;
 cin>>stno;
 while(stno!=-1)
	{temp=new item;     //申请新的结点
     temp->num=stno;    //向结点保存数据
     temp->next=head;   //初始表尾为NULL，以后用于结点的连接 
     head=temp;        //更新表头 
     cin>>stno;         //输入新数据
	} 
 cout<<"The output will be:"<<endl;
 temp=head;                  //非空表可略 
 while(temp!=NULL)
	{cout<<setw(6)<<temp->num;
     temp=temp->next;}
 cout<<endl;
}
