ex1405.cpp
来自「practice c++, it is from the book http:/」· C++ 代码 · 共 39 行
CPP
39 行
// Programming with C++ by John R. Hubbard
// Copyright McGraw-Hill, 1999
// Example 14.5 on page
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef vector<string> strings;
typedef strings::iterator sit;
void load(strings&);
void print(strings);
int main()
{ strings v, w;
load(v);
w=v;
sort(v.begin(),v.end());
print(v);
print(w);
}
void load(strings& v)
{ v.push_back("Japan");
v.push_back("Italy");
v.push_back("Spain");
v.push_back("Egypt");
v.push_back("Chile");
v.push_back("Zaire");
v.push_back("Nepal");
v.push_back("Kenya");
}
void print(strings v)
{ for (sit it=v.begin(); it!=v.end(); it++)
cout << *it << endl;
cout << endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?