++


next_permutation() - 2


smuil smuli suilm suiml sulim sulmi sumil sumli

uilms uilsm uimls uimsl uislm uisml ulims ulism

ulmis ulmsi ulsim ulsmi umils umisl umlis umlsi

umsil umsli usilm usiml uslim uslmi usmil usmli

*/

 

int main()

{

vector<char,allocator> vec(5);

// : musil

vec[0] = 'm'; vec[1] = 'u'; vec[2] = 's';

vec[3] = 'i'; vec[4] = 'l';

int cnt = 2;

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

for_each( vec.begin(), vec.end(), ppc ); cout << "\t";

// "musil"

while( next_permutation( vec.begin(), vec.end()))

{

for_each( vec.begin(), vec.end(), ppc );

cout << "\t";

if ( ! ( cnt++ % 8 )) {

cout << "\n";

cnt = 1;

}

}

cout << "\n\n";

return 0;

}




- -  - -  - -