資源簡介
火車訂票系統(MFC),含源代碼以及幫助說明

代碼片段和文件信息
//?BookDialog.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“火車票訂票系統.h“
#include?“BookDialog.h“
#include?“SearchDialog.h“
#include?“listTraininfo.h“
#include?“checi.h“
#include?
#include?
#include?
using?namespace?std;
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CBookDialog?dialog
CBookDialog::CBookDialog(CWnd*?pParent?/*=NULL*/)
:?CDialog(CBookDialog::IDD?pParent)
{
//{{AFX_DATA_INIT(CBookDialog)
m_name?=?_T(““);
m_data?=?_T(““);
m_month?=?_T(““);
m_tel?=?_T(““);
m_start?=?_T(““);
m_stop?=?_T(““);
m_seat?=?_T(““);
m_number?=?_T(““);
m_trainNum?=?_T(““);
//}}AFX_DATA_INIT
}
void?CBookDialog::DoDataExchange(CDataExchange*?pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBookDialog)
DDX_Text(pDX?IDC_EDIT1?m_name);
DDX_CBString(pDX?IDC_COMBO3?m_data);
DDX_CBString(pDX?IDC_COMBO2?m_month);
DDX_Text(pDX?IDC_EDIT2?m_tel);
DDX_Text(pDX?IDC_EDIT4?m_start);
DDX_Text(pDX?IDC_EDIT5?m_stop);
DDX_CBString(pDX?IDC_COMBO4?m_seat);
DDX_Text(pDX?IDC_EDIT3?m_number);
DDX_Text(pDX?IDC_EDIT6?m_trainNum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBookDialog?CDialog)
//{{AFX_MSG_MAP(CBookDialog)
ON_BN_CLICKED(IDC_BUTTON_SEARCH?OnButtonSearch)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CBookDialog?message?handlers
void?CBookDialog::OnOK()?
{
//?TODO:?Add?extra?validation?here
CDialog::OnOK();
UpdateData();
if(m_trainNum?==?““?||?m_seat==?““?||?m_start==?““?||?m_name?==?““?||
m_tel?==?““?||?m_number?==?““?||?m_stop?==?““?||?m_month?||?m_data)?{
MessageBox(“訂票信息不完整,無法訂票!“?“錯誤“);
return;
}
int?flag?=?0;
checi?*ch=?new?checi;
ch->m_strname?=?m_name;
string?temp;
ifstream?in(“record.txt“);
while(in?>>?temp)?{
if(temp?==?ch->m_strname)?{
flag?=?1;
MessageBox(“您已預定過票!“?“注意“);
in.close();
m_name=?““;
UpdateData(false);
return;
}
}
in.close();
listTraininfo(?ch);
delete?ch;
clean(); //?清空表格
MessageBox(“訂票成功“);
//?TODO:?Add?extra?validation?here
// CDialog::OnOK();?
}
void?CBookDialog::listTraininfo(checi*?ch)?????????????????
{
ch->m_strname?=?m_name;
ch->m_strtel?=?m_tel;
ch->m_strnumber?=m_number;
ch->m_strseat=?m_seat;
ch->m_strstart?=?m_start;
????ch->m_strstop=m_stop;
ch->m_strtrainNum?=?m_trainNum?;
ch->m_strmonth?=m_month;
ch->m_strdata=m_data;
ofstream?ou;
ou.open(“record.txt“?ios::app); //?選擇附加模式
ou?< ou?<m_strname;
ou?<m_strtel;
ou?<m_strnumber;
ou?<m_strseat;
ou?<m_strstart;
ou?<m_strstop;
ou?<m_strtrainNum;
ou?<m
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3259??2012-07-02?16:20??火車票訂票系統\BookDialog.cpp
?????文件???????1423??2012-07-02?16:20??火車票訂票系統\BookDialog.h
?????文件???????3639??2012-07-02?16:20??火車票訂票系統\CancelDialog.cpp
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\CancelDialog.h
?????文件???????3503??2012-07-02?16:20??火車票訂票系統\CBookDialog.cpp
?????文件???????1424??2012-07-02?16:20??火車票訂票系統\CBookDialog.h
?????文件???????3625??2012-07-02?16:20??火車票訂票系統\CCancelDialog.cpp
?????文件???????1543??2012-07-02?16:20??火車票訂票系統\CCancelDialog.h
?????文件???????1080??2012-07-02?16:20??火車票訂票系統\checi.cpp
?????文件????????983??2012-07-02?16:20??火車票訂票系統\checi.h
?????文件????????527??2012-07-02?16:20??火車票訂票系統\clean.cpp
?????文件????????526??2012-07-02?16:20??火車票訂票系統\clean.h
?????文件???????5567??2012-07-02?16:20??火車票訂票系統\CSearchDialog.cpp
?????文件???????1533??2012-07-02?16:20??火車票訂票系統\CSearchDialog.h
?????文件??????38850??2012-07-02?16:20??火車票訂票系統\Debug\BookDialog.obj
?????文件??????39689??2012-07-02?16:26??火車票訂票系統\Debug\CBookDialog.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\CBookDialog.sbr
?????文件??????34915??2012-07-02?16:20??火車票訂票系統\Debug\CCancelDialog.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\CCancelDialog.sbr
?????文件??????22673??2012-07-02?16:20??火車票訂票系統\Debug\checi.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\checi.sbr
?????文件??????10801??2012-07-02?16:20??火車票訂票系統\Debug\clean.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\clean.sbr
?????文件??????34015??2012-07-02?16:20??火車票訂票系統\Debug\CSearchDialog.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\CSearchDialog.sbr
?????文件??????10939??2012-07-02?16:20??火車票訂票系統\Debug\listTraininfo.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\listTraininfo.sbr
?????文件???????9101??2012-07-02?16:20??火車票訂票系統\Debug\MyDialog.obj
?????文件??????????0??2012-07-02?16:20??火車票訂票系統\Debug\MyDialog.sbr
?????文件?????105580??2012-07-02?16:20??火車票訂票系統\Debug\StdAfx.obj
............此處省略45個文件信息
- 上一篇:VC 截屏或抓屏程序
- 下一篇:VC6.0 winsock編程.pdf
評論
共有 條評論