链表

梦想游戏人
目录:
C/C++
#include <iostream>
using namespace std;

class node
{
	public:
	int data;
	node*ptr_next;	
	
};

int main(int argc, char *argv[])
{
	int n;
	node*head=new node;
	node*p=head;
	while(cin>>n)
	{
		p->data=n;
		p->ptr_next=new node;
		p=p->ptr_next;	
	}
	
	p->ptr_next=0;
	p=head;
	while(p->ptr_next)
	{
		cout<<	p->data<<" ";
		p=p->ptr_next;	
		
	}
	
	return 0;
}
Scroll Up