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

📄 studentdlg.cpp

📁 mfc实验例题也是高教得配套资料 刚找到得 这部分应该是自学的内容
💻 CPP
字号:
// StudentDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Ex3_1.h"
#include "StudentDlg.h"
#include <fstream.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStudentDlg dialog


CStudentDlg::CStudentDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStudentDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStudentDlg)
	m_sDepart = _T("");
	m_dComputer = 0.0;
	m_dEnglish = 0.0;
	m_nID = 0;
	m_dMath = 0.0;
	m_sName = _T("");
	m_dPhysics = 0.0;
	m_nSex = -1;
	//}}AFX_DATA_INIT
}


void CStudentDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStudentDlg)
	DDX_CBString(pDX, IDC_COMBO_DEPART, m_sDepart);
	DDX_Text(pDX, IDC_EDIT_COMPU, m_dComputer);
	DDX_Text(pDX, IDC_EDIT_ENG, m_dEnglish);
	DDX_Text(pDX, IDC_EDIT_ID, m_nID);
	DDX_Text(pDX, IDC_EDIT_MATH, m_dMath);
	DDX_Text(pDX, IDC_EDIT_NAME, m_sName);
	DDX_Text(pDX, IDC_EDIT_PHYSICS, m_dPhysics);
	DDX_Radio(pDX, IDC_SEX_MALE, m_nSex);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CStudentDlg message handlers

void CStudentDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	ofstream file1("stu.dat",ios::out|ios::ate);
	file1<<m_sDepart<<'\t'<<m_dComputer<<'\t'<<m_dEnglish<<'\t'<<m_nID<<'\t'<<m_dMath<<'\t'<<m_sName<<'\t'<<m_dPhysics<<m_nSex<<'\n';
	
	CDialog::OnOK();
}

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

⌨️ 快捷键说明

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