/* * File: main.cpp * Author: Lefteris * * Created on 22 Μαρτίου 2016, 3:32 μμ */ #include using namespace std; void endless(int i) { cout << i << endl; if (i>0) endless(i - 1); } int factorial(int n) { int rslt = 1; for (int i = 1; i <= n; i++) rslt = rslt * i; return rslt; } int factorialR(int n) { if (n == 1 || n == 0) return 1; return n * factorialR(n - 1); } void prtSym(int n) { if (n <= 0) return; cout << n << " "; prtSym(n - 1); cout << n << " "; } void moveOne(int diskNo, char from, char to) { cout << "move disk " << diskNo << " from " << from << " to " << to << endl; } void moveDisks(int n, char s, char d, char a) { if (n == 1) moveOne(n, s, d); else { moveDisks(n - 1, s, a, d); moveOne(n, s, d); moveDisks(n - 1, a, d, s); } } int main(int size, char** params) { //prtSym(3); moveDisks(3,'s','d','a'); //endless(3); //cout << params[0] << endl; //cout << params[1] << endl; //cout << params[2] << endl; return 0; }