Explanation of Ques10

kindly explain the solution of question 10 that why the answer is not b and A.

@Mansi-Garg-813225092449370 post the question here please( i cant see which one is 10th)

Q10. Algorithms STL#10 Given the following code snippet : string s = “bca”; do { cout << s << ’ '; } while(next_permutation(s.begin(), s.end())); cout << s; What is the output of the given code? bca cab cba abc bca cab cba cba bca bca bca bca bca cab cba bca

@Mansi-Garg-813225092449370 whats your answer?

my answer is bca cab cba cba

@Mansi-Garg-813225092449370 no it will be bca cab cba abc as cba next permutation will give the starting one

@Mansi-Garg-813225092449370 refer the example here
http://www.cplusplus.com/reference/algorithm/next_permutation/
dont forget to hit like and mark resolved if cleared :smiley: