I basically want to create strings that consist of three operation symbols (eg: +-*
or ++/
or +++
). Each one of these strings should be pushed into vector <string> opPermutations
This is my code so far:
// Set up permutations for operators
string operatorBank[4] = {"+","-","*","/"};
do {
string currentPerm = operatorBank[0] + operatorBank[1] + operatorBank[2] + operatorBank[3];
this -> opPermutations.push_back(currentPerm);
} while ( std::next_permutation(operatorBank, operatorBank + 4) );
The permutations that are pushed into the vector (as strings) are:
+-*/
+-/*
+/*-
+/-*
-*+/
-*/+
-+*/
-+/*
-/*+
-/+*
/*+-
/*-+
/+*-
/+-*
/-*+
/-+*
What I want however is to have my permutations exist like this:
- Each should be three characters in length
- Every possible permutation, including the ones in which a character is repeated more than one time, must be present.
I want it to be organized as such:
+++
---
***
///
/*/
+-+
++*
**/
etc...
How can I achieve this?