c++list运用
来源:互联网 发布:java方法重写 编辑:程序博客网 时间:2024/04/30 18:58
//temp tp1, tp2;
//tp1.a = 1;
//tp1.name = "tp1name";
//tp2.a = 2;
//tp2.name = "tp2name";
//vector<temp> vt;
//vt.push_back(tp1);
//vt.push_back(tp2);
//for (vector<temp>::iterator it = vt.begin(); it != vt.end(); it++)
//{
// cout << ((temp)*it).name << endl;
//}
list<int> one(5, 2);
int stuff[5] = { 1, 2, 3, 8, 6 };
list<int> two;
two.insert(two.begin(), stuff, stuff + 5);
int more[6] = { 6, 4, 2, 4, 6, 5 };
list<int> three(two);
three.insert(three.end(), more, more + 6);
int resum = accumulate(two.begin(), two.end(), 0); //list中元素相加
cout << resum << endl;
/*for (list<int>::iterator it = two.begin(); it != two.end(); it++)
{
cout << *it << endl;
}
*/
list<int>::iterator it;
it = max_element(two.begin(), two.end()); //list取最大元素
cout << *it << endl;
- c++list运用
- C++ list的运用
- list.h 简单运用
- List列表的运用
- java-list运用
- hdu1216(list运用)
- j2me的list的 运用
- 踢球游戏-运用list切片
- hash和list的运用
- C++Builder消息运用
- UVA12504【C++STL运用】
- List-C
- C list
- Struts1中ActionForm 的List运用
- pku2153 Rank List (STL的运用)
- LWUIT的List运用系列(五)
- LWUIT的List运用系列目录,共七篇
- Struts1中ActionForm 的List运用
- oracle-参数文件
- libconfig第一篇———使用指南
- Unity+Kinect SDK
- sublime text 2 快捷键及我喜欢的插件大全
- uva 10827
- c++list运用
- linux下IPTABLES配置详解
- Android编程心得-ListView的Item高亮显示的办法
- LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
- 解决ubuntu下NVIDIA与intel双显卡切换问题
- uestc Another LCIS 区间线段树
- test
- Java中的Enum用法介绍
- uva548(树)