C++的内库STL中包含链表,可以直接使用。
#include<iostream>
#include<string>
#include<list> //STL:标准模板类库
using namespace std;
struct student
{
string name;
int age;
int num;
};
int main()
{
list<string> myList;
myList.push_back("我");
myList.push_back("喜欢");
myList.push_back("你");
while (!myList.empty())
{
cout << myList.front();
myList.pop_front();
}
cout << endl;
list<student> myStudentList;
system("pause");
return 0;
}
需要用的时候再搜索。