hi
plz hlp me in make this c language prog.
123
132
213
231
321
312

Recommended Answers

All 4 Replies

This is the C++ forum and you don't as people to do your assignments or whatever that is without showing some input other than what you want your output to be.

Look up the next_permutation() and prev_permutation() functions in the <algorithm> header. Literally, by the way. They are template functions, so you can open that header as a text document and read the implementation to figure out how it is done. :)

No, next_permutation won't work because his desired output is out of order :)

Hope this helps :)

#include <stdio.h>
int main(void) {
  puts("123");
  puts("132");
  puts("213");
  puts("231");
  puts("321");
  puts("312");
  return 0;
}

No, next_permutation won't work because his desired output is out of order :)

OK, store it in a vector and use random_shuffle(). :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.