//003 용기에 용기를 끼워 넣으면 모든 데이터를 출력합니다

1038 단어 STL
//003                    
#include
#include
#include 
using namespace std;

void test01()
{
	vector> v;//v       vector     
	vector v1;
	vector v2;
	vector v3;
	vector v4;
	for (int i = 0; i < 4;i++)
	{
		// 4 vector             
		v1.push_back(i + 1);
		v2.push_back(i + 1);
		v3.push_back(i + 1);
		v4.push_back(i + 1);
	}
	// v1,2,3,4  vector v   

	v.push_back(v1);
	v.push_back(v2);
	v.push_back(v3);
	v.push_back(v4);
	//      ,          ,         ,         
	//                ,  *      
	for (vector>::iterator it = v.begin(); it != v.end(); it++)
	{
		for (vector::iterator it2 = (*it).begin();it2!=(*it).end(); it2++)//   it       ,*         
		{
			cout << (*it2) << endl;
		}
		cout << endl;
	}

}
int main(void)
{
	test01();
	system("pause");
	return 0;
}
/*
 * 1
2
3
4

1
2
3
4

1
2
3
4

1
2
3
4

       . . .
 */

좋은 웹페이지 즐겨찾기