#include <iostream>
using namespace std;
struct LinkNode
{
int data;
LinkNode *next;
};
void init(LinkNode *&head)
{
head=new LinkNode;
head->next=NULL;
}
void create(LinkNode *&head)
{
int i;
cin>>i;
if(i==0)
head->next=NULL;
else
{
head->next=new LinkNode;
head->next->data=i;
using namespace std;
struct LinkNode
{
int data;
LinkNode *next;
};
void init(LinkNode *&head)
{
head=new LinkNode;
head->next=NULL;
}
void create(LinkNode *&head)
{
int i;
cin>>i;
if(i==0)
head->next=NULL;
else
{
head->next=new LinkNode;
head->next->data=i;

该博客介绍了一个C++程序,通过递归函数在带头结点的单链表中寻找所有结点的最大值。程序包括初始化链表、创建链表、递归求最大值节点及显示链表元素的功能。
最低0.47元/天 解锁文章
1215

被折叠的 条评论
为什么被折叠?



