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

📄 seteight.cpp

📁 两个人工智能小程序
💻 CPP
字号:
// SetEight.cpp : implementation file
//

#include "stdafx.h"
#include "AIWork2.h"
#include "SetEight.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSetEight dialog


CSetEight::CSetEight(CWnd* pParent /*=NULL*/)
	: CDialog(CSetEight::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetEight)
	m_iOne = 0;
	m_iTwo = 0;
	m_iThree = 0;
	m_iFour = 0;
	m_iFive = 0;
	m_iSix = 0;
	m_iSeven = 0;
	m_iEight = 0;
	m_iZero = 0;
	//}}AFX_DATA_INIT
}


void CSetEight::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetEight)
	DDX_Text(pDX, IDC_EDIT1, m_iOne);
	DDV_MinMaxInt(pDX, m_iOne, 0, 8);
	DDX_Text(pDX, IDC_EDIT2, m_iTwo);
	DDV_MinMaxInt(pDX, m_iTwo, 0, 8);
	DDX_Text(pDX, IDC_EDIT3, m_iThree);
	DDV_MinMaxInt(pDX, m_iThree, 0, 8);
	DDX_Text(pDX, IDC_EDIT4, m_iFour);
	DDV_MinMaxInt(pDX, m_iFour, 0, 8);
	DDX_Text(pDX, IDC_EDIT5, m_iFive);
	DDV_MinMaxInt(pDX, m_iFive, 0, 8);
	DDX_Text(pDX, IDC_EDIT6, m_iSix);
	DDV_MinMaxInt(pDX, m_iSix, 0, 8);
	DDX_Text(pDX, IDC_EDIT7, m_iSeven);
	DDV_MinMaxInt(pDX, m_iSeven, 0, 8);
	DDX_Text(pDX, IDC_EDIT8, m_iEight);
	DDV_MinMaxInt(pDX, m_iEight, 0, 8);
	DDX_Text(pDX, IDC_EDIT9, m_iZero);
	DDV_MinMaxInt(pDX, m_iZero, 0, 8);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetEight, CDialog)
	//{{AFX_MSG_MAP(CSetEight)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetEight message handlers

BOOL CSetEight::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_iOne   =4;
	m_iTwo   =2;
	m_iThree =3;
	m_iFour  =0;
	m_iFive  =8;
	m_iSix   =5;
	m_iSeven =7;
	m_iEight =1;
	m_iZero  =6;
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CSetEight::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);
	eightMap[0][0]=m_iOne;
	eightMap[0][1]=m_iTwo;
	eightMap[0][2]=m_iThree;
	eightMap[1][0]=m_iFour;
	eightMap[1][1]=m_iFive;
	eightMap[1][2]=m_iSix;
	eightMap[2][0]=m_iSeven;
	eightMap[2][1]=m_iEight;
	eightMap[2][2]=m_iZero;
	//判断是否有重复数字
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			for(int m=0;m<3;m++)
			{
				for(int n=0;n<3;n++)
				{
					if(m!=i||n!=j)
						if(eightMap[m][n]==eightMap[i][j])
						{
							MessageBox("有重复的数字,请重新输入。","警告");
							return;
						}
				}
			}
		}
	}
	CDialog::OnOK();
}

⌨️ 快捷键说明

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