12-04-01.cpp

来自「more efftive 代码」· C++ 代码 · 共 22 行

CPP
22
字号
#include <iostream>#include <algorithm>#include <vector>#include <string>#include <iterator>using namespace std;int main(){  vector<string> fruits;  fruits.push_back("cherry");  fruits.push_back("apple");  fruits.push_back("peach");  fruits.push_back("plum");  fruits.push_back("pear");    replace(fruits.begin(), fruits.end(),          string("apple"), string("orange"));  copy(fruits.begin(), fruits.end(),       ostream_iterator<string>(cout, "\n"));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?