📄 infoinput.cpp
字号:
// InfoInput.cpp : implementation file
//
#include "stdafx.h"
#include "si_chp1502.h"
#include "InfoInput.h"
#include "si_chp1502Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern Student mystudents[10];
extern int studentcount;
/////////////////////////////////////////////////////////////////////////////
// CInfoInput dialog
CInfoInput::CInfoInput(CWnd* pParent /*=NULL*/)
: CDialog(CInfoInput::IDD, pParent)
{
//{{AFX_DATA_INIT(CInfoInput)
m_strName = _T("");
m_strNumber = _T("");
//}}AFX_DATA_INIT
}
void CInfoInput::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInfoInput)
DDX_Text(pDX, IDC_NAME, m_strName);
DDX_Text(pDX, IDC_NUMBER, m_strNumber);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInfoInput, CDialog)
//{{AFX_MSG_MAP(CInfoInput)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInfoInput message handlers
void CInfoInput::OnOK()
{
// TODO: Add extra validation here
UpdateData();
if(studentcount<10)
{
BOOL bExist=FALSE;
for(int i=0;i<studentcount;i++)
{
if(mystudents[i].m_strNumber==m_strNumber)
{
MessageBox("该学生的学号已经存在");
bExist=TRUE;
continue;
}
}
if(!bExist)
{
mystudents[studentcount].m_strName=m_strName;
mystudents[studentcount].m_strNumber=m_strNumber;
studentcount++;
}
}
else
MessageBox("已经不能在输入新的学生信息了.");
CDialog::OnOK();
}
void CInfoInput::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -