fork(1) download
  1. #include <iostream>
  2. #include <algorithm> // std::next_permutation, std::sort
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main (){
  7. string palavra;
  8.  
  9. palavra = "BIO";
  10. cout << "Entre com a palavra" << endl;
  11. cin >> palavra;
  12.  
  13. std::sort (palavra.begin(),palavra.end());
  14.  
  15. system("cls");
  16. do {
  17. std::cout << palavra << '\n';
  18. } while ( std::next_permutation(palavra.begin(),palavra.end()) );
  19.  
  20.  
  21.  
  22. cin.ignore();
  23. return 0;
  24. }
Success #stdin #stdout #stderr 0s 3468KB
stdin
BIO
stdout
Entre com a palavra
BIO
BOI
IBO
IOB
OBI
OIB
stderr
sh: 1: cls: not found