#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string value;
// vector<string> *ps;
// typedef vector<string> *vstring;
// vstring ps;
vector<string*> ps;
while (cin >> value)
{
string *sp = new string;
*sp = value;
ps.push_back(sp);
}
for (vector<string*>::iterator iter = ps.begin(); iter != ps.end(); ++iter)
{
// cout << *iter << " " << endl;
// string p = **iter;
cout << **iter << ":" << (**iter).size() << endl;
}
return 0;
}
C++ Primer 习题 5.18 vector中存放指针
最新推荐文章于 2024-01-08 11:32:51 发布
