⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 towermfcdlg.h

📁 用c++的MFC写的汉诺塔程序
💻 H
字号:
// TowerMfcDlg.h : header file
//

#if !defined(AFX_TOWERMFCDLG_H__CABBE030_34B6_4ABA_945B_86D66EE31F36__INCLUDED_)
#define AFX_TOWERMFCDLG_H__CABBE030_34B6_4ABA_945B_86D66EE31F36__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Tower.h"
#include <vector>
using namespace std;
/////////////////////////////////////////////////////////////////////////////
// CTowerMfcDlg dialog
#include "InitDlg.h"
struct StartToEnd
{
	int a;
	int b;
	BOOL move;
};
class CTowerMfcDlg : public CDialog
{
// Construction
public:
	CTowerMfcDlg(CWnd* pParent = NULL);	// standard constructor
	void hanoi(int n,int a,int b,int c);
public:
	void MoveBToA(int A, int B);
	void MoveAToB(int A,int B);
	void Down(int i);
	void Up(int i);
	BOOL m_move;				//设置汉诺塔的动不动
	CTower m_tower_first;
	CTower m_tower_second;
	CTower m_tower_third;
	CTower m_tower[3];			//三个塔的向量
	BOOL   m_first;				///用于第一次显示
	BOOL   m_first_add;			//第一次添加
	int	   floor;				//汉诺塔的层数
	vector<StartToEnd> m_line;	//保存路线
	int		m_i;				//向量的下标
	BOOL   arrivetop;			//判断是不是到顶了
	BOOL   arrivedown;			//是不是已经到底了
	BOOL   IsPop;				//是否出栈
	BOOL   first;
// Dialog Data
	//{{AFX_DATA(CTowerMfcDlg)
	enum { IDD = IDD_TOWERMFC_DIALOG };
	int		m_stopnum;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTowerMfcDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CTowerMfcDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnStart();
	afx_msg void OnStop();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TOWERMFCDLG_H__CABBE030_34B6_4ABA_945B_86D66EE31F36__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -