?? dbg.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;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -