注册 登录
编程论坛 C++教室

list如何进行数据输出的呢

newCpp 发布于 2010-05-17 18:57, 1706 次点击
list<int> the_list;
list<int>::iterator the;  
  
for( int ii = 0; ii < 10; ii++ )

{
the_list.push_back( ii );   
}
for (the=the_list.begin();the!=the_list.end();the++) //标准库输出的方式
{
cout << *the<< endl;
}
the=the_list.begin();
the++;
cout <<*the<< endl;
让the++;地址自加太麻烦了!
不知道有没有什么快捷点儿的方法!例如我现在想让the输出the_list里第5个数据元素的值
该如何才能够做到的呢?
0 回复
1