From 40a62c4ab1162b921fb689ebc27acaafbbff66e8 Mon Sep 17 00:00:00 2001 From: otrk <32101332+otrk@users.noreply.github.com> Date: Tue, 30 Oct 2018 00:33:41 +0530 Subject: [PATCH] Create zap.c --- c/zap.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 c/zap.c diff --git a/c/zap.c b/c/zap.c new file mode 100644 index 0000000..e3655b3 --- /dev/null +++ b/c/zap.c @@ -0,0 +1,27 @@ +#include +#include +#include + +#define all(c) c.begin(), c.end() +#define tr(container, it) \ + for(typeof((container).begin()) it = (container).begin(); it != (container).end(); it++) + +using namespace std; + +int main(void) +{ + // vector v; + + // for (int i = 0; i < 3; i++) + // v.push_back(i); + string v = "hello"; + + vector::iterator it; + do { + tr(v, it) + { + cout << *it << " "; + } + cout << endl; + } while (next_permutation(all(v))); +}