CPP program to generate permutations with only one swap allowed .
#include <cstring> NEW_LINE #include <iostream> NEW_LINE using namespace std ; void findPermutations ( char str [ ] , int index , int n ) { if ( index >= n || ( index + 1 ) >= n ) { cout << str << endl ; return ; }