// 0915.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <list> #include <iostream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { list<string> slist; string strInput; while (cin >> strInput) slist.push_back(strInput); cout << "the size is: " << slist.size() << endl; for (list<string>::iterator iter = slist.begin();iter != slist.end();iter++) cout << *iter << endl; return 0; } 基本和9.14一样,vector改为list