8新建文件 03#include using namespace std ;struct Node{ int data ; Node * next ; Node():data(0){next = NULL;} Node(int d){data = d ; next = NULL ;}};//带头节点的单链表class List{ Node * head ;public: List(){ head = new Node() ; } //用数组初始化链表 List(int datas[] ,int n) { head = new Node() ; Node * h , * r ; r = head ; for(int i = 0 ; i < n; i++){ h = new Node(datas[i]) ; r->next = h ; r = h ; } } //打印链表中所有的值 void PrintList() const{ Node * p = head->next ; while(p){ cout<data ; if(p->next)cout<<',' ; p=p->next ; } }};int main(){ int datas[] ={ 2,3,4,5,6,9,8,7,1} ; List list(datas,sizeof(datas)/sizeof(int)) ; cout<<'List is ' ; list.PrintList() ; cout<