From b5c0cd40560c1227ab6d047e81b23c03f6a2403d Mon Sep 17 00:00:00 2001 From: sagar Date: Sun, 22 Oct 2023 11:22:09 +0545 Subject: [PATCH] TowerofHanoi solved c++ --- .github/workflows/c-cpp.yml | 23 ----------------------- .vscode/settings.json | 5 ++++- C++/TowerofHanoi | Bin 0 -> 34320 bytes C++/TowerofHanoi.cpp | 22 ++++++++++++++++++++++ 4 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/c-cpp.yml create mode 100755 C++/TowerofHanoi create mode 100644 C++/TowerofHanoi.cpp diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml deleted file mode 100644 index b00b272..0000000 --- a/.github/workflows/c-cpp.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: C/C++ CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: configure - run: ./configure - - name: make - run: make - - name: make check - run: make check - - name: make distcheck - run: make distcheck diff --git a/.vscode/settings.json b/.vscode/settings.json index 3e5eb95..f6aaca9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -55,5 +55,8 @@ "C_Cpp_Runner.useLeakSanitizer": false, "C_Cpp_Runner.showCompilationTime": false, "C_Cpp_Runner.useLinkTimeOptimization": false, - "C_Cpp_Runner.msvcSecureNoWarnings": false + "C_Cpp_Runner.msvcSecureNoWarnings": false, + "files.associations": { + "iostream": "cpp" + } } \ No newline at end of file diff --git a/C++/TowerofHanoi b/C++/TowerofHanoi new file mode 100755 index 0000000000000000000000000000000000000000..fda00628a09e226a808fe17b7a7f2de6bb76ddfe GIT binary patch literal 34320 zcmeHwdw5jUx%b+$GnolHOhN)77la8A1(A@1aKD91AW=ZBiinPrnMpE|%!HW<7i+Cb ztx}|dR;%?=>aDhFkJ{={YpqsA?Zs*@)*fpQr`B_zwXIr?rE1Oj{ob|r%w!0k9G~xb zzVDChJhR`m-rIWDyY6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ww^F1%4p=FE|cLTST&#Eu0s@a&=c6j#lG{Jg)5o^%`2Di!~9lSUj3A*TC6&;H3*1@zydp+5GGBL zM31V)UO}W5)8kq^Nx)Vuwr?{iPBX)kqhTAha8WBBKXfQz@5JK;RU6(BLlPQd8735L z^CY>b%#H*=!@4_20Xx)#Gd^mifNK$~?Z7^_1h~em#n(^~m1wM`sw? zoS4?3`w%VRgppLRI|^l59L1?>vA*g?p9CBqtb;R%2Z_MzsBGamq_(z1WUE8Lx0oYN z7#?(jM5B%*2I%Miw0|1Qze(r1O8!w%>sd*bbwO3_9|BFNRkXKZ-c%JLeKQ&^d>Yyu5P#zXdp+@#o0% za2Z|>bo}So@9;U0?|$;kKqu~;8|c6bs0^3mW5<4t#e292(5H_4Q9FGH&a@47(s$&Y z{C~xkUt}wE&P8@80EF!HpRxrUc&Q_3Lr0$jAIp(<=F1MOwCkgz#*uU4Kgf}H z=Isu|Tbli@T>m|1%RA+-{5HD{**>$cT=}1Z$oxC<%l(==4Rthq&y{~2lx+DM{hHN* zg(PNOPW^FEe8UW{=1ChQ&RKtMn9NwFymTy6{~SHL$4PY_sl zonms_j`u>ASxn0>Km=FM6b<)kkiI+iIFR%CYU(u%vZ8~ryhv=m1@N#<~heb%?&uESda|Cjt>VE*9&N?Fi literal 0 HcmV?d00001 diff --git a/C++/TowerofHanoi.cpp b/C++/TowerofHanoi.cpp new file mode 100644 index 0000000..45641d3 --- /dev/null +++ b/C++/TowerofHanoi.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +void towerOfHanoi(int n, char source, char auxiliary, char destination) { + if (n == 1) { + cout << "Move disk 1 from " << source << " to " << destination << endl; + return; + } + + towerOfHanoi(n - 1, source, destination, auxiliary); + cout << "Move disk " << n << " from " << source << " to " << destination << endl; + towerOfHanoi(n - 1, auxiliary, source, destination); +} + +int main() { + int n; + cout << "Enter the number of disks: "; + cin >> n; + + towerOfHanoi(n, 'A', 'B', 'C'); + return 0; +}