标签:上下 microsoft turn names bin 检查 i++ eve mil
C++ STD函数
#include <numeric>
#include <iterator>
#include <ostream>
#include <iostream>
#include <list>
using namespace std;
using namespace std;
int main(){
list<int> coll;
coll.push_back(1,2,3,4,5,6);
list<int>::iterator i;
for(i=coll.begin();i!=coll.end();i++)
cout<<*i<<" ";
cout<<"inner reverse product:"<<inner_product(coll.begin(),coll.end(),coll.begin(),0)<<endl;//(0+1×1 +2×2 +3×3+4×4+5*5+6*6)
cout<<"inner reverse product:"<<inner_product(coll.begin(),coll.end(),coll.rbegin(),0)<<endl;//(0+1×6 +2×5+3×4+4×3+5*2+6*1)
//(1* 1+1 * 2+2 * 3+3 * 4+4 * 5+5 * 6+6)
cout<<"product of sums:"<<inner_product(coll.begin(),coll.end(),coll.begin(),1,multiplies<int>(),plus<int>())<<endl;
return 0;
}
标签:上下 microsoft turn names bin 检查 i++ eve mil
原文地址:http://www.cnblogs.com/FuLiuWei/p/fuliuweistd.html