aboutsummaryrefslogtreecommitdiffstats
path: root/C++/rec.cpp
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-03-13 22:41:56 +0000
committerzedarider <ymherklotz@gmail.com>2016-03-13 22:41:56 +0000
commit050fcedf124b15f4f94cadbed73d8d95c354d7b6 (patch)
tree12de0506a58c542352cedf8c91bc2ac98bd2d717 /C++/rec.cpp
parentf52b1d4a370f1720995337a1eb3e01f9383af2e4 (diff)
downloadimperial_2015-050fcedf124b15f4f94cadbed73d8d95c354d7b6.tar.gz
imperial_2015-050fcedf124b15f4f94cadbed73d8d95c354d7b6.zip
Adding binary tree algorithms
Diffstat (limited to 'C++/rec.cpp')
-rw-r--r--C++/rec.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/C++/rec.cpp b/C++/rec.cpp
new file mode 100644
index 0000000..9ec892e
--- /dev/null
+++ b/C++/rec.cpp
@@ -0,0 +1,24 @@
+#include <iostream>
+
+using namespace std;
+
+void returnDigits(int&);
+
+int main(int argc, char** argv) {
+ int n;
+ cout << "input a number to seperate:" << endl;
+ cin >> n;
+ returnDigits(n);
+ return 0;
+}
+
+void returnDigits(int &n) {
+ if(n > 10) {
+ int d = n % 10;
+ n /= 10;
+ returnDigits(n);
+ cout << d << endl;
+ } else {
+ cout << n << endl;
+ }
+}