📄 inputdialog.cpp
字号:
// InputDialog.cpp : implementation file
//本程序用于接收用户的输入数据
#include "stdafx.h"
#include "CompareSort.h"
#include "InputDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInputDialog dialog
CInputDialog::CInputDialog(CWnd* pParent /*=NULL*/)
: CDialog(CInputDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CInputDialog)
m_Number = 0;
m_Input = _T("");
//}}AFX_DATA_INIT
}
void CInputDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInputDialog)
DDX_Text(pDX, IDC_EDIT2, m_Number);
DDV_MinMaxInt(pDX, m_Number, 1, 40);
DDX_Text(pDX, IDC_EDIT1, m_Input);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInputDialog, CDialog)
//{{AFX_MSG_MAP(CInputDialog)
ON_BN_CLICKED(IDC_CLEAN, OnClean)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInputDialog message handlers
//*****************响应Cancel键***********************
void CInputDialog::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
//****************响应OK键,接受输入********************
void CInputDialog::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE); //接受输入
int i=0;
int j=0;
m_Input+=',';
m_Input+='#';
while(m_Input[i]!='#')
{
if(m_Input[i]==',')
j++; //计算输入数据个数
i++;
}
if(j<Num)
{
AfxMessageBox("输入的数据个数不够,请继续输入!");
return ;
}
CDialog::OnOK();
}
//****************响应Clean键,清空输入********************
void CInputDialog::OnClean() //清空
{
// TODO: Add your control notification handler code here
m_Input="";
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -