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

📄 search.cpp

📁 本程序是用VC++编写的一个简单的学生信息录入查找系统
💻 CPP
字号:
// Search.cpp : implementation file
//

#include "stdafx.h"
#include "si_chp1502.h"
#include "Search.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;

/////////////////////////////////////////////////////////////////////////////
// CSearch dialog


CSearch::CSearch(CWnd* pParent /*=NULL*/)
	: CDialog(CSearch::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSearch)
	m_strNumtosearch = _T("");
	m_strResult = _T("");
	//}}AFX_DATA_INIT
}


void CSearch::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSearch)
	DDX_Text(pDX, IDC_NUMTOSEARCH, m_strNumtosearch);
	DDX_Text(pDX, IDC_RESULT, m_strResult);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSearch, CDialog)
	//{{AFX_MSG_MAP(CSearch)
	ON_BN_CLICKED(IDC_START, OnStart)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSearch message handlers

void CSearch::OnStart() 
{
	// TODO: Add your control notification handler code here
	BOOL bSuccess=FALSE;
	UpdateData();
	for(int i=0;i<studentcount;i++)
	{
		if(mystudents[i].m_strNumber==m_strNumtosearch)
		{
			m_strResult=mystudents[i].m_strName ;
			bSuccess=TRUE;
			UpdateData(FALSE);
			break;
		}
	}
	if(!bSuccess)
		MessageBox("查找失败");
}

void CSearch::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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