C++学习,第四十八课(完)
已有 631 次阅读2014-8-27 12:00
|个人分类:作业
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
int main()
{
std::vector<std::string> names;
names.push_back("Microsoft");
names.push_back("Apple");
names.push_back("IBM");
names.push_back("Google");
names.push_back("Tencent");
names.push_back("Baidu");
names.push_back("Firefox");
std::sort(names.begin(), names.end());
std::vector<std::string>::iterator iter = names.begin();
while (iter != names.end())
{
std::cout << *iter << "\n";
++iter;
}
system("pause");
return 0;
}