📄 cpp05.cpp
字号:
// Coded by plusir -- Jan.13.2003.
// Standard C++ Bible -- (P686-24-5)
#include <iostream>
#include <vector>
using namespace std ;
int main()
{
vector<int> v( 5 ) ;
vector<int>::iterator it = v.begin(), saveIt = it ;
*it++ = 10 ;
*it++ = 15 ;
*it++ = 20 ;
*it++ = 25 ;
*it = 30 ;
it -= 2 ;
*it = 100 ;
cout << "Contents of the vector:" << endl ;
while ( saveIt != v.end() )
cout << *saveIt++ << endl ;
saveIt -= 1 ;
cout << "Contents of the vector backwards:" << endl ;
while ( saveIt >= v.begin() )
cout << *saveIt-- << endl ;
return 0 ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -