C++学习笔记-list遍历

时间:2014-06-08 03:24:24   收藏:0   阅读:357
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <list>
#include <deque>
#include <string>
#include <numeric>
#include <algorithm>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
	int ia[]={0,1};
	list<int>::iterator itor;  //定义迭代器
	list<int> myList;  //定义LIST
	//给list添加值
	for(int ix=0;ix!=10;++ix)
	{
		myList.push_back(ix);
	}
	
	//从list第一个iterator开始
	itor = myList.begin();
	while(itor!=myList.end())
    {
        cout<< *itor++<<endl;
    } 
	
	return 0;
}

C++学习笔记-list遍历,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!