diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-08-23 20:10:42 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-08-23 20:10:42 -0400 |
commit | cdb9d9849d6c4a35522284fd72998ae53b3860b0 (patch) | |
tree | 1ca33c35cd9354f9ddf87b7e8b4c2056019ca6fc | |
parent | 0df54ca55134c4240c43fd7db50d665e0c32ccb3 (diff) |
New file for permutating a string input.
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | permute.cpp | 32 |
2 files changed, 36 insertions, 0 deletions
@@ -1,4 +1,8 @@ CPPFLAGS=-Wall +all: check-endian permute + check-endian: check-endian.cpp + +permute: permute.cpp diff --git a/permute.cpp b/permute.cpp new file mode 100644 index 0000000..561f9da --- /dev/null +++ b/permute.cpp @@ -0,0 +1,32 @@ + +#include <cstdlib> +#include <iostream> +#include <cstring> +#include <string> + +using namespace std; + +void do_permute(const char* s, size_t, string& buf) +{ +} + +void permute(const char* s, size_t n) +{ + for (size_t i = 0; i < n; ++i) + { + string buf; + buf.push_back(s[i]); + } +} + +int main(int argc, char** argv) +{ + if (argc <= 1) + return EXIT_FAILURE; + + size_t n = strlen(argv[1]); + cout << "input string: " << argv[1] << " (len = " << n << ")" << endl; + permute(argv[1], n); + + return EXIT_SUCCESS; +} |