标准模板库
来源:互联网 发布:u盘格式化数据恢复软件 编辑:程序博客网 时间:2024/06/07 07:00
#include<stdio.h>#include<stdlib.h>#include<iostream>#include<numeric>#include<list>using namespace std;//STL算法 accumulate//对顺序表元素进行累加求和 template<class T> T sum(T *a, int n) { //int thesum=0; int theProduct = 1;//初始化 //return accumulate(a, a + n, thesum);//求和 return accumulate(a, a + n, theProduct, multiplies<T>());//求积 } //copy函数的使用 copy(start,end,to) //template<class T>void main(){ int thesum = 0; int a[2] = { 14, 3 }; cout <<sum<int>(a,2)<< endl; list<int> list1; list<int> list2; list2.push_back(1); list2.push_back(2); //cout << copy(list2, 2, list1) << endl; system("pause");}
0 0
- 模板与标准模板库
- 标准模板库
- 标准模板库(STL)
- STL标准模板库
- 标准模板库介绍
- STL标准模板库
- 标准模板库介绍
- STL标准模板库
- STL标准模板库
- 标准模板库介绍
- 标准模板库介绍
- STL 标准模板库
- 标准模板库 (STL)
- C++标准模板库
- STL标准模板库
- 标准模板库-STL
- STL 标准模板库
- 标准模板库STL
- CCF NOI1072 爬楼梯
- int--String
- C#147课的主要内容
- pat B1064
- C语言编写实际问题看法
- 标准模板库
- [MapleStory项目进展]
- P1541 乌龟棋
- SDL2画点 随手记
- 腾讯笔试之“已知rand7()可以产生1~7的7个数(均匀概率),利用rand7() 产 生 rand10() 1~10(均匀概率)。”
- Unity基础.001脚本的生命周期
- 四元数的插值
- Socket.io在IOS10.3.1系统出现短线重现,transport error
- Linux中的In命令-软链接和硬链接