STL中链表的基本操作

#include "stdafx.h"
#include
<list>
#include
<iostream>
using namespace std;

ostream
& operator<<(ostream& out, list<int>& a){
    list
<int>::iterator iter;
    
for(iter=a.begin(); iter!=a.end(); iter++)
        
out<<*iter<<" ";
    
out<<endl;
    
return out;
}

int main(){
    list
<int> A;
    
for(int i=0;i<10;i++)
        A.push_back(i
*i);
    cout
<<A;
    system(
"pause");
}

posted on 2008-10-23 12:43 deep2 阅读(460) 评论(0)  编辑 收藏 引用 所属分类: 链表

<2009年2月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
1234567

导航

统计

常用链接

留言簿(1)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜