📄 chapter11-14.cpp
字号:
//文件名:CHAPTER11-14.cpp
#include <vector>
#include <algorithm>
#include <iostream>
int main( ) {
using namespace std;
vector <int> v1;
vector <int>::iterator Iter1;
int i;
for ( i = 0 ; i <= 9 ; i++ ){v1.push_back( i );}
int ii;
for ( ii = 0 ; ii <= 3 ; ii++ ) {v1.push_back( 7 );}
random_shuffle (v1.begin( ), v1.end( ) );
cout << "The original vector v1 is:\n ( " ;
for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ ) cout << *Iter1 << " ";
cout << ")." << endl;
// Replace elements with a value of 7 with a value of 700
replace (v1.begin( ), v1.end( ), 7 , 700);
cout << "The vector v1 with a value 700 replacing that of 7 is:\n ( " ;
for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ ) cout << *Iter1 << " ";
cout << ")." << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -