summaryrefslogtreecommitdiff
path: root/hanoi.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 /hanoi.cc
parent6c957dc4e01aee6ce9cae3c8342d04b0fd9ca9c4 (diff)
Moved all C++ files into CPP folder
Diffstat (limited to 'hanoi.cc')
-rw-r--r--hanoi.cc29
1 files changed, 0 insertions, 29 deletions
diff --git a/hanoi.cc b/hanoi.cc
deleted file mode 100644
index b401060..0000000
--- a/hanoi.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// ConsoleApplication1.cpp : definisce il punto di ingresso dell'applicazione console.
-//
-#include "stdafx.h"
-#include <iostream>
-
-using namespace std;
-
-static unsigned long int tot = 0;
-
-void hanoi(int d, int inizio, int fine, int transito)
-{
- if (d == 1);
- else {
- hanoi(d - 1, inizio, transito, fine);
- hanoi(d - 1, transito, fine, inizio);
- }
- tot++;
-}
-
-int main()
-{
- int dischi;
- cout << "Numero dischi: ";
- cin >> dischi;
-
- hanoi(dischi, 1, 3, 2);
- cout << "In totale: " << tot << " mosse" << endl;
- return 0;
-}