• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            yanzi

            null

            ????????????上網(wǎng)時,偶然發(fā)現(xiàn)有人在變漢諾塔程序,于是就由C語言編了一個小小的程序。大家有興趣可以see see !!
            ????????? 我的漢諾塔程序采用的是遞歸調(diào)用的思想。
            ? 漢諾問題的遞歸思想就是三步走:
            原來都在A柱,輔助B柱,目標(biāo)C
            1)想辦法把A柱上的除最底下一個以外的盤借助C柱全部移到 B柱,
            2)把最后剩下的一個盤從A移到C
            3 )把 B 柱上的盤想辦法全部移到 C 柱。
            ?1?#include"stdio.h"
            ?2?void?movedisk(int?n,char?fromneedle,char?toneedle,char?usingneedle);?int?i=0;
            ?3?main()
            ?4?{int?m;
            ?5??int?stop=1;
            ?6??printf("??????????????**********************************\n");
            ?7??printf("??????????????*???Welcome?to?my?program!!!^-^??*\n");
            ?8??printf("??????????????**********************************\n");
            ?9??printf("This?is?a?Game?called?Hanoi,you?can?follow?the?steps?below?to?begin!!!\n");
            10???while(stop){i=0;
            11???????????????printf("Please?input?the?number?of?the?disk:");
            12???????????????scanf("%d",&m);
            13???????????????movedisk(m,'a','c','b');
            14???????????????printf("\nthe?fewest?steps?you?have?to?go?is?%d.\n",i);
            15???????????????printf("\nif?you?want?to?stop,input:0?,else?input:1\nInput:");
            16???????????????scanf("%d",&stop);
            17??????????????}
            18????getch();
            19??}
            20?
            21??void?movedisk(int?n,char?fromneedle,char?toneedle,char?usingneedle)
            22?{
            23??if(n==1)
            24?????printf("[%d]??%c--->%c\t",++i,fromneedle,toneedle);
            25???else?if(n>1)
            26??????{movedisk(n-1,fromneedle,usingneedle,toneedle);
            27???????printf("[%d]??%c--->%c\t",++i,fromneedle,toneedle);
            28???????movedisk(n-1,usingneedle,toneedle,fromneedle);
            29???????}
            30?
            31???}

            posted on 2006-05-19 20:49 yanzi0518 閱讀(532) 評論(1)  編輯 收藏 引用

            評論

            # re: null 2006-05-21 09:30 flyingxu

            能不能使用標(biāo)題呢?讓大家一目了然  回復(fù)  更多評論   


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評論

            • 1.?re: null
            • 能不能使用標(biāo)題呢?讓大家一目了然
            • --flyingxu
            国产人久久人人人人爽| 亚洲国产一成久久精品国产成人综合| 久久天天躁狠狠躁夜夜avapp| 99精品久久精品一区二区| 丰满少妇人妻久久久久久| 亚洲综合精品香蕉久久网97| 国产亚洲色婷婷久久99精品91| 香蕉久久夜色精品国产尤物| 国产精品天天影视久久综合网| 久久av免费天堂小草播放| 欧美午夜精品久久久久免费视| 国产视频久久| 久久久久人妻一区精品性色av| 久久久久国产精品麻豆AR影院 | 少妇高潮惨叫久久久久久| 久久综合九色综合97_久久久| 波多野结衣久久一区二区| 99久久精品免费观看国产| 久久人妻少妇嫩草AV无码专区| 久久久久无码专区亚洲av| 久久天天躁狠狠躁夜夜96流白浆| 久久亚洲国产精品123区| 色偷偷888欧美精品久久久| 亚洲精品无码久久久久去q | 国产精品免费久久久久久久久| 久久精品国产2020| 亚洲午夜久久久| 国产高潮久久免费观看| 国产69精品久久久久9999APGF| 久久久久久久尹人综合网亚洲 | 久久成人精品| 久久精品国产福利国产秒| 久久精品aⅴ无码中文字字幕不卡| 超级97碰碰碰碰久久久久最新| 综合久久精品色| 久久精品中文字幕大胸| 久久人做人爽一区二区三区 | 亚洲AV无码一区东京热久久| 99久久99久久精品国产片果冻| 狠狠色丁香久久婷婷综合| 日韩乱码人妻无码中文字幕久久|