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

(새 문서: ==개요== ;C++ 벡터 rotate() <syntaxhighlight lang='cpp' run> #include <iostream> #include <vector> #include <algorithm> using namespace std; int main () { vector<int> v = {1,...)
 
20번째 줄: 20번째 줄:


==참고==
==참고==
* {{위키백과}}
* https://cplusplus.com/reference/algorithm/rotate/
* {{위키낱말사전}}
* {{다음사전}}
* {{다음백과}}
* {{네이버사전}}
* {{네이버백과}}
* {{나무위키}}
* {{리브레위키}}


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

2023년 9월 17일 (일) 20:46 판

1 개요

C++ 벡터 rotate()
#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 }}