diff options
author | Santo Cariotti <sancn@live.com> | 2017-01-27 21:12:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-27 21:12:07 +0100 |
commit | 54c7677db1fd2c4f8372d84d0585dbcd38825ecf (patch) | |
tree | c4d040eba47de8261cca0c562c89a035161ef8dd | |
parent | b157733e205deaba5e1a43aed5bdda83333783b7 (diff) |
Add files via upload
-rw-r--r-- | substring.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/substring.cc b/substring.cc new file mode 100644 index 0000000..243024c --- /dev/null +++ b/substring.cc @@ -0,0 +1,22 @@ +#include <iostream> + +using namespace std; + +void s(int i, int k, int n, char str[]); + +int main() +{ + char ss[] = "SANTO"; + s(0, 4, sizeof(ss), ss); + + return 0; +} + +void s(int i, int k, int n, char str[]) +{ + if(i < n){ + if(i < n-k) for(int j = i; j < i+k; j++) cout << str[j]; + cout << "\n"; + s(i+=1, k, n, str); + } +} |