cpp03.cpp

来自「C++参考书」· C++ 代码 · 共 28 行

CPP
28 行
字号

// Coded by plusir -- Jan.13.2003.
// Standard C++ Bible -- (P681-24-3)

#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 ;

	cout << "Contents of the vector:" << endl ;

	while ( saveIt != v.end() )
		cout << *saveIt++ << endl ;

	return 0 ;
}

⌨️ 快捷键说明

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