C++/Skill (기본지식, 모던C++)

모던C++) 벡터의 원소들로 조합할 수 있는 모든 경우의 수 를 찾는 함수 next_permutation()

신우섭 2020. 5. 19. 22:23
vector<int> vecSource{5,1,3,6};

sort(vecSource.begin(), vecSource.end());

do
{
    for (int i = 0; i < vecSource.size(); i++)
    {
        cout << vecSource[i];
    }
    endl;

}while (next_permutation(vecTemp.begin(), vecTemp.end()));

벡터의 원소들로 조합할 수 있는 모든 경우의 수 출력