⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpp04.cpp

📁 C++参考书
💻 CPP
字号:

// Coded by plusir -- Jan.13.2003.
// Standard C++ Bible -- (P683-24-4)

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

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

	do {
		cout << *--saveIt << endl ;
	} while ( saveIt != v.begin() ) ;

	return 0 ;
}

⌨️ 快捷键说明

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