面试:
指针+数据=truct结构体=结点
一. head.h
头文件iostream
创建结点结构体struct Node
创建单链表及功能实现
二.head.cpp创建各功能
1无参构造函数 List<T>::List(T a[],int n)
2析构函数 List<T>::~List(){}
3遍历函数void List<T>::Print()
4插入函数
void List<T>::Insert(inti, T a[] ,int n)
三.main.cpp创建主函数
Void main
输入int a[]
输出 L.Print()
结束 system("pause");return 0;
工作:
尽量不动first
循环不用留头指针