summaryrefslogtreecommitdiff
path: root/cpp/substring.cc
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-04-26 16:37:39 +0200
committerSanto Cariotti <sancn@live.com>2017-04-26 16:37:39 +0200
commit483d63fa7249ad8d6020680c48c3cf6df35010b3 (patch)
tree2f8649e3ae6b42ace5011246285c9c450f004222 /cpp/substring.cc
parent6c957dc4e01aee6ce9cae3c8342d04b0fd9ca9c4 (diff)
Moved all C++ files into CPP folder
Diffstat (limited to 'cpp/substring.cc')
-rw-r--r--cpp/substring.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpp/substring.cc b/cpp/substring.cc
new file mode 100644
index 0000000..55aa319
--- /dev/null
+++ b/cpp/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 - k){
+ if(i < n-k) for(int j = i; j < i+k; j++) cout << str[j];
+ cout << "\n";
+ s(i+=1, k, n, str);
+ }
+}