This program illustrates the use of the STL next_permutation() algorithm (extended version) to generate all permutations of a vector of integers, in 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 smaller 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: 51 25 17 Press Enter to continue ... And here are the contents of the vector as each permutation is generated: 51 17 25 25 51 17 25 17 51 17 51 25 17 25 51 Press Enter to continue ... Finally (for this vector), here are its contents after all permutations have been generated: 51 25 17 Press Enter to continue ... Here are the contents of a second vector of 5 integers before any permutations are generated: 11 25 17 51 55 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: 11 17 51 25 55 Return value: true Vector contents: 11 17 25 51 55 Return value: false Vector contents: 11 51 25 17 55 Return value: true Vector contents: 11 51 17 25 55 Return value: true Vector contents: 11 25 51 17 55 Return value: true Vector contents: 11 25 17 51 55 Press Enter to continue ...