如何显示stl中list的指定元素?比如显示第二个。
解决方案 »
- VC 单文档程序如何用指定的打印机打印 ?
- C/S结构能实现google地图载入吗?
- CFileDialog文件打开框初始化问题
- 求算法:关于任意封闭线的面积
- 怎么把文件复制到局域网的另一台机器相???
- 请问如何才能把一个字节数组.装入VARIANT变量中,又如何才能从VARIANT变量中取出一个字节.
- 为什么主窗口的WM_PAINT消息触发了,而子窗口的WM_PAINT却触发不了?
- 谁在用VS.net,为什么我的程序断点都运行不到了?Debug模式呀。
- MFC中怎样找到加入project 的文件?
- 关于打印,请指教
- DirectSound怎么实现独立控制音量?
- CWinThread内创建的CSocket没有OnRecieve响应
貌似list按存储顺序来遍历
LIST<int>::iterator the_iterator; for( int i=0; i < 10; i++ )
the_LIST.push_back(i);//将list存入10个元素 int total = 0;
the_iterator = the_LIST.begin();//将LIST第一个指针给交给the_iterator
while( the_iterator != the_LIST.end() ) {然后通过the_iterator遍历list
total += *the_iterator;
the_iterator++;
}
copy(list.begin(), list.end(), ostream_iterator<int>(cout, " "));
这是显示所有。能不能只显示一个或几个?
list<int>::iterator iter;
iter=m_list.begin();
*(++iter)就是这了