标准模板11

#include<iostream>
#include<numeric>
#include<functional>
#include<vector>
using namespace std;
int main()
{
int iarray[]={1,2,3,4,5};
vector<int>ivector(iarray,iarray+sizeof(iarray)/sizeof(int));
cout<<accumulate(ivector.begin(),ivector.end(),0)<<endl;
cout<<(inner_product(ivector.begin(),ivector.end(),ivector.begin(),10))<<endl;
partial_sum(ivector.begin(),ivector.end(),ostream_iterator<int>(cout," "));
adjacent_difference(ivector.begin(),ivector.end(),ostream_itreator<int>(cout," "));
cout<<endl;
return 0;
}

posted @ 2023-05-12 21:06  不会JAVA的小袁  阅读(2)  评论(0编辑  收藏  举报