"Alex Vinokur" <al****@big.foot.com> writes:
Does STL contain algorithms which generate (enable to generate) exponents, permutations, arrangements, and combinations for any
numbers and words?
exponents?
Here's a quickie example of permutations that I had lying around. See the
doc for details.
#include <vector> //for vector
#include <functional> //for less
#include <iostream>
using namespace std;
int main()
{
char a2[] = "abcdefghij";
vector<char> m2(a2, a2+10);
vector<char> next_m2((size_t)10);
next_m2=m2;
next_permutation(next_m2.begin(),
next_m2.end(),less<int>());
cout << "Original values: ";
copy(m2.begin(),m2.end(),
ostream_iterator<char>(cout," "));
cout << endl;
cout << "Next Permutation: ";
copy(next_m2.begin(),next_m2.end(),
ostream_iterator<char>(cout," "));
cout << endl << endl;
return 0;
}