我的代码

#include <bits/stdc++.h>
using namespace std;
struct node
{
	int data;
	node* next;
};
node* create()
{
	int num;
	node*t;
	cin>>num;
	if(num==0)
	t=NULL;
	else
	{
		t=new node[1];
		t->data=num;
		t->next=create();
	}
        return t;
}
int main()
{
	node* head;
	head=create();
	node*p=head;
	while(p!=NULL)
	{
		cout<<p->data<<" ";
		p=p->next;	
	}			
} 

相关文章:

  • 2022-01-13
  • 2021-08-15
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2021-07-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2021-09-22
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
相关资源
相似解决方案