Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  4
Language: C/C++
Code:
#include <algorithm>
#include <array>
#include <iostream>
#include <iterator>
#include <string>
 
int main()
{
    std::array<std::string, 3> a;
    for (auto &s : a)
        std::cin >> s;
    std::sort(a.begin(), a.end());
    do
    {
        std::copy(a.cbegin(), a.cend(), std::ostream_iterator<std::string>(std::cout, " "));
        std::cout << std::endl;
    } while (std::next_permutation(a.begin(), a.end()));
}
          
Comments: