This program illustrates the use of the STL prev_permutation() algorithm (extended version) to generate all permutations of a vector of integers, in decreasing order, and also to demonstrate what happens to the return value of the algorithm when the "end" of a permutation sequence is reached and we then "roll over" to begin a new sequence. In this case the order of the integers in a permutation is determined by one integer preceding another if and only if it has a larger digit sum. Press Enter to continue ... First, we declare a vector of 3 integers and show all of its permuations. Here are the contents of the vector before any permutations are generated: 17 25 51 Press Enter to continue ... And here are the contents of the vector as each permutation is generated: 17 51 25 25 17 51 25 51 17 51 17 25 51 25 17 Press Enter to continue ... Finally (for this vector), here are its contents after all permutations have been generated: 17 25 51 Press Enter to continue ... Here are the contents of a second vector of 5 integers before any permutations are generated: 55 25 51 17 11 Press Enter to continue ... Now we show the return value of the algorithm, and the contents of this vector, after each of 6 permutations of just the middle 3 values. Press Enter to continue ... Return value: true Vector contents: 55 51 17 25 11 Return value: true Vector contents: 55 51 25 17 11 Return value: false Vector contents: 55 17 25 51 11 Return value: true Vector contents: 55 17 51 25 11 Return value: true Vector contents: 55 25 17 51 11 Return value: true Vector contents: 55 25 51 17 11 Press Enter to continue ...