"C++ 리스트"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
2번째 줄: 2번째 줄:
;C++ list
;C++ list
;C++ 리스트
;C++ 리스트
<source lang='cpp'>
<syntaxhighlight lang='cpp'>
#include <iostream>
#include <iostream>
#include <list>
#include <list>
18번째 줄: 18번째 줄:
// 4
// 4
// 8
// 8
</source>
</syntaxhighlight>
<source lang='cpp'>
<syntaxhighlight lang='cpp'>
#include <iostream>
#include <iostream>
#include <list>
#include <list>
39번째 줄: 39번째 줄:
// 8
// 8
// 6
// 6
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:47 기준 최신판

1 개요[ | ]

C++ list
C++ 리스트
#include <iostream>
#include <list>

using namespace std;

int main() {
	list<int> l = { 3, 1, 4, 8 };
	for (int n : l) {
	    std::cout << n << '\n';
	}
}
// 3
// 1
// 4
// 8
#include <iostream>
#include <list>

using namespace std;

int main() {
	list<int> l = { 3, 1, 4, 8 };
	l.push_front(5);
	l.push_back(6);
	for (int n : l) {
	    std::cout << n << '\n';
	}
}
// 5
// 3
// 1
// 4
// 8
// 6

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}