资源简介
传教士与野人过河程序设计问题:设有3个传教士和3个野人来到河边,打算乘一只船从左岸渡到右岸去。该船的负载能力为两人。在任何时候,如果野人人数超过传教士人数,那么野人就会把传教士吃掉。请用A*算法实现传教士和野人用这条船安全地把所有人都渡过河去。编程工具
采用VC++6.0
代码片段和文件信息
// missionary and savage.cpp : Defines the class behaviors for the application.
//
#include “stdafx.h“
#include “missionary and savage.h“
#include “missionary and savageDlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMissionaryandsavageApp
BEGIN_MESSAGE_MAP(CMissionaryandsavageApp CWinApp)
//{{AFX_MSG_MAP(CMissionaryandsavageApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMissionaryandsavageApp construction
CMissionaryandsavageApp::CMissionaryandsavageApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMissionaryandsavageApp object
CMissionaryandsavageApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMissionaryandsavageApp initialization
BOOL CMissionaryandsavageApp::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.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
AfxInitRichEdit();
CMissionaryandsavageDlg dlg;
m_pMainWnd = &dlg;
int 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;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4850688 2010-01-13 10:54 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.bsc
文件 122988 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.exe
文件 236072 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.ilk
文件 14829 2010-01-13 10:54 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.obj
文件 7028272 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.pch
文件 418816 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.pdb
文件 3120 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.res
文件 0 2010-01-13 10:54 missionary and savage-20100113\missionary and savage\Debug\missionary and savage.sbr
文件 27763 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\missionary and savageDlg.obj
文件 0 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\missionary and savageDlg.sbr
文件 4461 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\PointStruct.obj
文件 0 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\PointStruct.sbr
文件 60322 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\SearchPoint.obj
文件 0 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\SearchPoint.sbr
文件 106103 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\StdAfx.obj
文件 1376748 2010-01-13 09:31 missionary and savage-20100113\missionary and savage\Debug\StdAfx.sbr
文件 205824 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\Debug\vc60.idb
文件 364544 2010-01-13 10:54 missionary and savage-20100113\missionary and savage\Debug\vc60.pdb
..AD... 0 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\Debug
文件 36488 2010-01-13 11:02 missionary and savage-20100113\missionary and savage\missionary and savage.aps
文件 1364 2010-01-13 14:46 missionary and savage-20100113\missionary and savage\missionary and savage.clw
文件 2274 2010-01-13 10:54 missionary and savage-20100113\missionary and savage\missionary and savage.cpp
文件 4712 2010-01-12 16:42 missionary and savage-20100113\missionary and savage\missionary and savage.dsp
文件 567 2010-01-12 14:47 missionary and savage-20100113\missionary and savage\missionary and savage.dsw
文件 1473 2010-01-12 14:47 missionary and savage-20100113\missionary and savage\missionary and savage.h
文件 91136 2010-01-13 14:46 missionary and savage-20100113\missionary and savage\missionary and savage.ncb
文件 56832 2010-01-13 14:46 missionary and savage-20100113\missionary and savage\missionary and savage.opt
文件 1042 2010-01-13 11:01 missionary and savage-20100113\missionary and savage\missionary and savage.plg
文件 6016 2010-01-13 11:02 missionary and savage-20100113\missionary and savage\missionary and savage.rc
文件 4553 2010-01-13 09:30 missionary and savage-20100113\missionary and savage\missionary and savageDlg.cpp
............此处省略17个文件信息
评论
共有 条评论