All pastes #513239 Raw Edit

Something

public cpp v1 · immutable
#513239 ·published 2007-05-27 05:34 UTC
rendered paste body
/* Liet ke tat ca các hoan vi cua 1 chuoi */#include <iostream>#include <iomanip>#include <string>using namespace std;void swap ( char &r, char &c ){        char temp = r;        r = c;        c = temp;}void permutation_string ( string s, string pre ){        int n = s.length();        if ( n == 1 )        {                cout << pre + s << endl;        }        else        {                for ( int i = 0; i < n; i++ )                {                        swap ( s[i], s[0] );                        permutation_string ( s.substr (1, n-1 ), pre + s.substr (0,1) );                                                                        cout << "--------------------------";                        cout << endl;                        cout << " N equal to  : " << n << endl;                        cout << "s.substr (1, n-1 ) is :  " <<  s.substr (1, n-1 ) << endl;                        cout << "pre is :  " <<  pre   << endl;                        cout << "s.substr (0,1) is :  " << s.substr (0,1) << endl;                }        }}void main(){        string a_string;        cout << "Enter a string: "; cin >> a_string;                print ( a_string, " ");        cin >> a_string;}