본문 바로가기
PROGRAMING📚/자료구조📑

STL_템플릿 _list,string사용해서 출력

별찌루 2021. 4. 3.
728x90
반응형

#include<iostream>

#include<list>

#include<string>

using namespace std; 

 

 

void main() {

 

   list<string>myList;

   myList.push_back("abcd");

   myList.push_back("아카데미");

   myList.push_back("홍길동");

   

   list<string>::iterator iter = myList.begin();

   while (iter != myList.end()) {

      string t = *iter;

      cout << t.c_str() << endl;

      iter++;

   }

 

 

}

728x90
반응형

댓글