Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Wednesday, January 06, 2016

write a program to display all possible permutations of a given input string in C++ | How to Find all Possible combination of strings in C++

write a program to display all possible permutations of a given input string in C++ | How to Find all Possible combination of strings in C++

This Program find the all permutations of string in C++ Program . The Permutations of strings mean all the possible combinations of characters in the string.

Source Code 

#include <iostream>
using namespace std;
/*
 * Uzair
 */
void permutationFunction(void);
int global = 2;

int main()
{
 cout<<"Starting Program\n";
 permutationFunction();
 cout<<"\nProgram Ended";
 return 0;
}

void permutationFunction(){
 string string;
 cout<<"Enter a string of characters to View Permutations\n";
 getline(cin, string);
  cout<<"\n";
 for(int j = 0; j < string.size(); j++)
 {
  cout << string[j];
  for(int k = 0; k < string.size(); k++)
  {
   if(j != k)
    cout << string[k];
  }
  cout << endl;
 }
}

Output of the Program

Share:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

Unordered List