Dynamic Linked List experience and dynamic experience
# Include <iostream> using namespace std; struct Node {int date; // the data of the Node struct Node * next; // point to the next Node}; Node * head = NULL; // define the linked list header as a global variable to facilitate subsequent operations on void make_list (); // create the linked list void out_list (); // output the linked list int main () {make_list (); out_list (); return 0;} void make_list () {int n; Node * p; cout <"Enter positive numbers (end with 0 or a negative number) create a linked list: "<endl; cout <endl; cin> n; while (n> 0) // enter positive numbers to create a linked list. When a positive number is input, the creation process ends {p = new Node; // create a Node p-> date = n; p-> next = Head; // the newly created node points to the head of the original linked list = p; // The head of the linked list is assigned as the newly created node. In this way, the new node is always the head of the linked list cin> n; // enter a positive number to create the next Node} return;} void out_list () {Node * p = head; cout <"the data in the linked list is:" <endl; cout <endl; while (p! = NULL) {cout <p-> date <""; p = p-> next;} cout <endl; return ;}