• <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

            ????????????上網時,偶然發現有人在變漢諾塔程序,于是就由C語言編了一個小小的程序。大家有興趣可以see see !!
            ????????? 我的漢諾塔程序采用的是遞歸調用的思想。
            ? 漢諾問題的遞歸思想就是三步走:
            原來都在A柱,輔助B柱,目標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 閱讀(534) 評論(1)  編輯 收藏 引用

            評論

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

            能不能使用標題呢?讓大家一目了然  回復  更多評論   

            <2006年5月>
            30123456
            78910111213
            14151617181920
            21222324252627
            28293031123
            45678910

            導航

            統計

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評論

            • 1.?re: null
            • 能不能使用標題呢?讓大家一目了然
            • --flyingxu
            亚洲国产成人精品91久久久| 青草影院天堂男人久久| 三级片免费观看久久| 国产精品99久久久久久宅男小说| 亚洲精品NV久久久久久久久久| 人妻无码αv中文字幕久久琪琪布 人妻无码精品久久亚瑟影视 | 激情伊人五月天久久综合| 精品久久777| 久久精品国产99国产精品导航| 99久久99久久| 中文字幕精品久久久久人妻| 99国产精品久久| 九九精品久久久久久噜噜| 人人狠狠综合久久亚洲婷婷| 久久久久国产精品人妻| 久久精品一区二区影院| 99久久久精品| 麻豆亚洲AV永久无码精品久久| 天堂无码久久综合东京热| 国产一区二区精品久久| 久久99这里只有精品国产| 久久er国产精品免费观看8| 国产国产成人精品久久| 人妻久久久一区二区三区| 一本大道久久东京热无码AV| 国产精品成人99久久久久| 99久久无色码中文字幕| 久久亚洲AV成人无码电影| 一本久久综合亚洲鲁鲁五月天| 国产一久久香蕉国产线看观看| 欧美午夜精品久久久久免费视| 精品久久久久久无码不卡| 日韩AV毛片精品久久久| 久久精品一区二区影院 | 国内精品伊人久久久影院| 久久精品国产亚洲精品| 久久国产福利免费| 久久99精品久久久久久野外 | 久久人人爽人人爽人人片AV高清 | 久久久亚洲精品蜜桃臀| 2020最新久久久视精品爱|