⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbg.cpp

📁 文本相似度比较```很好的`
💻 CPP
字号:
#include <iostream>
#include <string>


using namespace std;

typedef struct ListNode
{
	int m_Content;
	ListNode * Next;	
}Node;

// Create a new node
Node * CreateNode(int Content)
{
	Node * a = new Node;
	a->m_Content = Content;
	a->Next = NULL;
	return a;
}

// Create a list
Node * CreateList(int a)
{
	Node * header = NULL;
	Node * cur;
	for (int i = 0; i < a; i++)
	{
		// Create a new node
		Node * a = CreateNode(i);
		if (header == NULL)
		{
			cur = header = a;
		}
		else
		{
			cur->Next = a;
			cur = cur->Next;
			
		}
	}

	return header;
}

//Free the list
void FreeList(Node * head)
{
	Node * cur = head->Next;
	Node * pre = head;

	while (cur != NULL)
	{
		delete pre;
		pre = cur;
		cur = cur->Next;
	}
}

void PrintNode(Node * hd)
{
	Node * header = hd;
	while(header != NULL)
	{
		cout << header->m_Content << endl;
		header = header->Next;
	}
}

int main()
{
	int a;
	cin >> a;
	Node * t = CreateList(a);

	PrintNode(t);

	FreeList(t);

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -