資源簡介
輸入n,計算出相應的皇后總數,點擊逐個顯示皇后的擺放位置(基于遞歸算法)

代碼片段和文件信息
//?nQueen.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“nQueen.h“
#include?“nQueenDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#endif
//?CnQueenApp
BEGIN_MESSAGE_MAP(CnQueenApp?CWinApp)
ON_COMMAND(ID_HELP?&CWinApp::onhelp)
END_MESSAGE_MAP()
//?CnQueenApp?construction
CnQueenApp::CnQueenApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
//?The?one?and?only?CnQueenApp?object
CnQueenApp?theApp;
//?CnQueenApp?initialization
BOOL?CnQueenApp::InitInstance()
{
//?InitCommonControlsEx()?is?required?on?Windows?XP?if?an?application
//?manifest?specifies?use?of?ComCtl32.dll?version?6?or?later?to?enable
//?visual?styles.??Otherwise?any?window?creation?will?fail.
INITCOMMONCONTROLSEX?InitCtrls;
InitCtrls.dwSize?=?sizeof(InitCtrls);
//?Set?this?to?include?all?the?common?control?classes?you?want?to?use
//?in?your?application.
InitCtrls.dwICC?=?ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//?of?your?final?executable?you?should?remove?from?the?following
//?the?specific?initialization?routines?you?do?not?need
//?Change?the?registry?key?under?which?our?settings?are?stored
//?TODO:?You?should?modify?this?string?to?be?something?appropriate
//?such?as?the?name?of?your?company?or?organization
SetRegistryKey(_T(“Local?AppWizard-Generated?Applications“));
CnQueenDlg?dlg;
m_pMainWnd?=?&dlg;
INT_PTR?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????13150??2010-06-30?21:30??nQueen\nQueen\Debug\BuildLog.htm
?????文件??????59100??2010-06-30?21:24??nQueen\nQueen\nQueen.aps
?????文件???????2084??2010-06-30?18:11??nQueen\nQueen\nQueen.cpp
?????文件????????504??2010-06-30?18:11??nQueen\nQueen\nQueen.h
?????文件???????5511??2010-06-30?21:24??nQueen\nQueen\nQueen.rc
?????文件???????5481??2010-06-30?18:19??nQueen\nQueen\nQueen.vcproj
?????文件???????1423??2010-06-30?21:31??nQueen\nQueen\nQueen.vcproj.20091022-1908.AdminTaogle.user
?????文件???????6232??2010-06-30?21:27??nQueen\nQueen\nQueenDlg.cpp
?????文件???????1056??2010-06-30?21:22??nQueen\nQueen\nQueenDlg.h
?????文件???????4021??2010-06-30?18:11??nQueen\nQueen\ReadMe.txt
?????文件??????21630??2005-08-12?16:37??nQueen\nQueen\res\nQueen.ico
?????文件????????397??2010-06-30?18:11??nQueen\nQueen\res\nQueen.rc2
?????文件????????862??2010-06-30?21:24??nQueen\nQueen\resource.h
?????文件????????206??2010-06-30?18:11??nQueen\nQueen\stdafx.cpp
?????文件???????2864??2010-06-30?18:11??nQueen\nQueen\stdafx.h
?????文件????????883??2010-06-30?18:11??nQueen\nQueen.sln
????..A..H.?????12288??2010-06-30?21:31??nQueen\nQueen.suo
?????目錄??????????0??2010-06-30?21:30??nQueen\nQueen\Debug
?????目錄??????????0??2010-06-30?18:11??nQueen\nQueen\res
?????目錄??????????0??2010-06-30?21:27??nQueen\nQueen
?????目錄??????????0??2010-06-30?21:33??nQueen
-----------?---------??----------?-----??----
???????????????137692????????????????????21
- 上一篇:程序員實用算法源代碼
- 下一篇:單片機電子琴設計用C語言編寫
評論
共有 條評論