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

📄 cpp14.cpp

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

// Coded by plusir -- Jan.12.2003.
// Standard C++ Bible -- (P670-23-14)

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std ;

int main()
{
	vector<int> v1, v2 ;

	for ( int i = 0; i < 5; i++ ) {
		v1.push_back( i ) ;
		v2.push_back( i + 2 ) ;
	}

	ostream_iterator<int> output( cout, " " ) ;
	cout << "The vector one: " ;
	copy( v1.begin(), v1.end(), output ) ;
	cout << endl << "The vector two: " ;
	copy( v2.begin(), v2.end(), output ) ;
	cout << endl ;

	int result = inner_product( v1.begin(), v1.end(), v2.begin(), 0 ) ;

	cout << "Result = " << result << endl ;

	return 0 ;
}

⌨️ 快捷键说明

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