91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

漢諾塔是一個很簡單的遞歸程序,這個代碼是將遞歸過程演示了一下,用vc6.0開發的。。。。

資源截圖

代碼片段和文件信息

//?hanoi.cpp?:?Defines?the?entry?point?for?the?application.
//

#include?“stdafx.h“
#include?“resource.h“

#define?MAX_LOADSTRING?100

//?Global?Variables:
HINSTANCE?hInst; //?current?instance
TCHAR?sztitle[MAX_LOADSTRING]; //?The?title?bar?text
TCHAR?szWindowClass[MAX_LOADSTRING]; //?The?title?bar?text

//?Foward?declarations?of?functions?included?in?this?code?module:
ATOM MyRegisterClass(HINSTANCE?hInstance);
BOOL InitInstance(HINSTANCE?int);
LRESULT?CALLBACK WndProc(HWND?UINT?WPARAM?LPARAM);
LRESULT?CALLBACK About(HWND?UINT?WPARAM?LPARAM);

#define?idc_1?201
#define?idc_2?202
#define?idc_3?203
struct

{

int???????????????????istyle?;

TCHAR?*???????????????szText?;

}

button[]?=

{

BS_PUSHBUTTON????????TEXT?(“盤子數“)
????????
BS_PUSHBUTTON?????TEXT?(“移動速度“)
????????
BS_PUSHBUTTON??????????TEXT?(“提交盤子數“)
????????
BS_AUTOCHECKBOX?????????TEXT?(“AUTOCHECKBOX“)
????????
BS_RADIOBUTTON???????TEXT?(“RADIOBUTTON“)
????????
BS_3STATE????????????TEXT?(“3STATE“)
????????
BS_AUTO3STATE????????TEXT?(“AUTO3STATE“)
????????
BS_GROUPBOX??????????TEXT?(“GROUPBOX“)
????????
BS_AUTORADIOBUTTON??????TEXT?(“AUTORADIO“)
????????
BS_OWNERDRAW????????????TEXT?(“OWNERDRAW“)
????????
}?;

bool?flag=false;
int?speed=1000;
//中外的殺人者竟然個個昂起頭來,不知臉上有血污。

class?dish
{
public:
int?index;
int?length;
dish(int?xint?y){index=x;length=y;}
dish(){}

};
class?hanoi
{
public:
HWND?hwnd;
int?i;//盤子數
int?width;//基礎長度
int?heightbottomtop;
int?xcyc;
POINT?x1[3];
POINT?x2[3];
POINT?y1[3];
POINT?y2[3];
stack?A[3];//柱子A
hanoi(){}

hanoi(int?xint?yint?zHWND?hnd)
{
i=x;xc=y;yc=z;
hwnd=hnd;
width=xc/10;
height=yc*0.7;

bottom=yc*0.8;

top=bottom-height;

x1[0].x=width*2;x1[0].y=bottom;x2[0].x=width*3;x2[0].y=bottom;
x1[1].x=width*4;x1[1].y=bottom;x2[1].x=width*5;x2[1].y=bottom;
x1[2].x=width*6;x1[2].y=bottom;x2[2].x=width*7;x2[2].y=bottom;

y1[0].x=width*2.5;y1[0].y=bottom;y2[0].x=width*2.5;y2[0].y=top;
y1[1].x=width*4.5;y1[1].y=bottom;y2[1].x=width*4.5;y2[1].y=top;
y1[2].x=width*6.5;y1[2].y=bottom;y2[2].x=width*6.5;y2[2].y=top;

for(int?j=0;j {
dish?temp(j(width*(i-j)/i));
A[0].push(temp);
}
}//這是初始化,其實好友許多沒有初始化。。。

void?init(){
InvalidateRect?(hwnd?NULL?TRUE)?;
MessageBox(hwnd“開始移動!!!!“““MB_OK);
move(i012);
}

void?move(int?nint?aint?bint?c)
{
if(n>0)
{

move(n-1acb);
Sleep(speed);
dish?temp=A[a].top();
A[a].pop();
A[b].push(temp);
InvalidateRect?(hwnd?NULL?TRUE)?;

move(n-1cba);
}
}


};
hanoi*?res;


DWORD?WINAPI?Thread?(PVOID?pParam)
{
flag=true;
res->init();
return?0;
}

int?APIENTRY?WinMain(HINSTANCE?hInstance
?????????????????????HINSTANCE?hPrevInstance
?????????????????????LPSTR?????lpCmdLine
?????????????????????int?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-11-12?13:30??hanoi\
?????文件????????5132??2010-11-12?13:29??hanoi\hanoi.aps
?????文件????????9079??2010-11-12?13:10??hanoi\hanoi.cpp
?????文件????????4470??2010-11-12?13:18??hanoi\hanoi.dsp
?????文件?????????533??2010-11-12?09:28??hanoi\hanoi.dsw
?????文件?????????323??2010-11-12?09:28??hanoi\hanoi.h
?????文件????????1078??2010-11-12?09:28??hanoi\hanoi.ico
?????文件???????41984??2010-11-12?13:29??hanoi\hanoi.ncb
?????文件???????48640??2010-11-12?13:29??hanoi\hanoi.opt
?????文件?????????906??2010-11-12?13:29??hanoi\hanoi.plg
?????文件????????3419??2010-11-12?13:29??hanoi\hanoi.rc
?????文件?????????875??2010-11-12?13:19??hanoi\hanoi.sln
?????文件????????7680??2010-11-12?13:22??hanoi\hanoi.suo
?????文件????????6805??2010-11-12?13:19??hanoi\hanoi.vcproj
?????文件????????2055??2010-11-12?09:28??hanoi\ReadMe.txt
?????文件?????????777??2010-11-12?09:28??hanoi\resource.h
?????文件?????????318??2010-11-12?09:28??hanoi\small.ico
?????文件?????????296??2010-11-12?10:29??hanoi\StdAfx.cpp
?????文件????????1067??2010-11-12?10:28??hanoi\StdAfx.h

評論

共有 條評論