先用C++写了一个线性表的类 来实现学生健康管理系统的代码 现在将其转化为MFC实现的方式,所有功能现在还差就是将文件读取并显示出来,本来想将其读取到列表框显示出来,但是现在实现的过程出现了一些问题 等再学一些MFC的文件操作之后再来改善一下,下面是现在的效果:
新建表的方法是先在新建编辑框里面输出初始化人数,然后按下新建表的键 再通过输入每个学生的信息 按下插入键 进行新建 其他功能的实现在操作工程中也都有相应的提示


下面是线性表类和dlg类的代码:
// TestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Stu_Healthy.h"
#include "TestDlg.h"
#include <fstream>
#include <string>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestDlg dialog
CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTestDlg::IDD, pParent)
{
//{
{AFX_DATA_INIT(CTestDlg)
m_birthday = _T("");
m_healthy = _T("");
m_name = _T("");
m_num = _T("");
m_pos = 0;
m_searchnum = _T("");
m_sex = _T("");
m_sum = 0;
m_once=FALSE;
m_new=-1;
m_array=0;
m_right=0;
//}}AFX_DATA_INIT
}
void CTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{
{AFX_DATA_MAP(CTestDlg)
DDX_Text(pDX, IDC_EDIT_BIRTHDAY, m_birthday);
DDX_Text(pDX, IDC_EDIT_HEALTHY, m_healthy);
DDX_Text(pDX, IDC_EDIT_NAME, m_name);
DDX_Text(pDX, IDC_EDIT_NUM, m_num);
DDX_Text(pDX, IDC_EDIT_POS, m_pos);
DDX_Text(pDX, IDC_EDIT_S, m_searchnum);
DDX_Text(pDX, IDC_EDIT_SEX, m_sex);
DDX_Text(pDX, IDC_EDIT_sum, m_sum);
DDV_MinMaxInt(pDX, m_sum, 1, 50);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
//{
{AFX_MSG_MAP(CTestDlg)
ON_BN_CLICKED(IDC_BUTTON_NEW, OnButtonNew)
ON_BN_CLICKED(IDC_BUTTON_DEL, OnButtonDel)
ON_BN_CLICKED(IDC_BUTTON_INSERT, OnButtonInsert)
ON_BN_CLICKED(IDC_BUTTON_PRINT, OnButtonPrint)
ON_BN_CLICKED(IDC_BUTTON_READ, OnButtonRead)
ON_BN_CLICKED(IDC_BUTTON_SEARCH, OnButtonSearch)
ON_BN_CLICKED(IDC_BUTTON_UPDATE, OnButtonUpdate)
ON_BN_CLICKED(IDC_BUTTON_WRITE, OnButtonWrite)
ON_BN_CLICKED(IDC_BUTTON_CLEAN, OnButtonClean)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
student *stu,e;
Sqlist sq;
/////////////////////////////////////////////////////////////////////////////
// CTestDlg message handlers
BOOL CTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetWindowText(_T("20102100227 kay"));
Messag

本文介绍了使用C++和MFC构建学生健康管理系统的过程。目前系统已实现大部分功能,包括线性表操作,但仍有文件读取显示的问题待解决。作者计划在进一步学习MFC文件操作后完善这一部分。文章提供了当前版本的源码下载,并展示了新建表和插入学生信息的步骤。
最低0.47元/天 解锁文章
168

被折叠的 条评论
为什么被折叠?



