"C++ 벡터 rotate()"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;C++ 벡터 rotate()
;C++ 벡터 rotate()
;C++ 벡터 회전


<syntaxhighlight lang='cpp' run>
<syntaxhighlight lang='cpp' run>
23번째 줄: 24번째 줄:


[[분류: C++ 벡터]]
[[분류: C++ 벡터]]
[[분류: C++ algorithm]]

2023년 9월 17일 (일) 20:48 기준 최신판

1 개요[ | ]

C++ 벡터 rotate()
C++ 벡터 회전
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main () {
  vector<int> v = {1, 2, 3, 4, 5};
  rotate(v.begin(), v.begin()+2, v.end());
  for(int x: v) cout << x << ' '; // 3 4 5 1 2
}

2 같이 보기[ | ]

3 참고[ | ]

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