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

📄 newaccount.cpp

📁 一个模仿ATM提款机的MFC程序
💻 CPP
字号:
// NewAccount.cpp : implementation file
//

#include "stdafx.h"
#include "atm.h"
#include "NewAccount.h"
#include "MutiCheck.h"
#include "NewExchange.h"
#include "ForeignAccount.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//CEnterPaswd enterpaswdlg;

/////////////////////国际卡用户////////////////////////////////////////////////////////
// NewAccount dialog

//CEnterPaswd enterpaswdlg;

NewAccount::NewAccount(CWnd* pParent /*=NULL*/)
	: CDialog(NewAccount::IDD, pParent)
{
	//{{AFX_DATA_INIT(NewAccount)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void NewAccount::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(NewAccount)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(NewAccount, CDialog)
	//{{AFX_MSG_MAP(NewAccount)
	ON_BN_CLICKED(IDCHANGECODE, OnChangecode)
	ON_BN_CLICKED(IDCHECK, OnCheck)
	ON_BN_CLICKED(IDEXCHANGE, OnExchange)
	ON_BN_CLICKED(IDTRANSFER, OnTransfer)
	ON_BN_CLICKED(IDWITHDRAW, OnWithdraw)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL NewAccount::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	// Add "About..." menu item to system menu.
	
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);
	
	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}
	
	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
//	SetIcon(m_hIcon, TRUE);			// Set big icon
//	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	ifstream fin("国际卡帐户.txt");//,ios::nocreate);
	if (fin.is_open())
	{
		
		while (!fin.eof())
		{
			CString acntNum;
			char strNo[19],strpwd[7];
			
			fin >> strNo;
			acntNum = strNo;
			CString  paswrd;
			fin>>strpwd;
			paswrd=strpwd;
			double balan;
			fin>>balan;
			double dollar;
			fin>>dollar;
			double mark;
			fin>>mark;
			double yen;
			fin>>yen;
			
			if(fin.eof())
				break;
			ForeignAccount *p1=new ForeignAccount(acntNum,paswrd,dollar,mark,yen);
			
			p1->reloadbalance(balan);
		}
		
		fin.close();
		
	}
	
	ifstream finE("国际卡外行帐户.txt");//,ios::nocreate);
	if (finE.is_open())
	{
		
		while (!finE.eof())
		{
			CString acntNum;
			char strNo[19],strpwd[7];
			
			finE >> strNo;
			acntNum = strNo;
			CString  paswrd;
			finE>>strpwd;
			paswrd=strpwd;
			double balan;
			finE>>balan;
			if(finE.eof())
				break;
			Exaccount *p2=new Exaccount(acntNum,paswrd);
			p2->reloadbalance(balan);
		}
		
		finE.close();
		
	}
	//	remove("外行帐户.txt");
	CEnterPaswd enterpaswdlg;
	enterpaswdlg.DoModal();


	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// NewAccount message handlers
void NewAccount::OnChangecode() 
{
	// TODO: Add your control notification handler code here
	
}

void NewAccount::OnCheck() 
{
	// TODO: Add your control notification handler code here
	MutiCheck dlg;
	dlg.DoModal();
}

void NewAccount::OnExchange() 
{
	// TODO: Add your control notification handler code here
	NewExchange DLG;
	DLG.DoModal();//improper
}


void NewAccount::OnTransfer() 
{
	// TODO: Add your control notification handler code here
	
}

void NewAccount::OnWithdraw() 
{
	// TODO: Add your control notification handler code here
//	KillTimer(0);
	CWithdraw withdrawdlg;
	withdrawdlg.DoModal();	
	
}

void NewAccount::OnCancel() 
{
	// TODO: Add extra cleanup here
	ForeignAccount::storageC();	
//	CPhoneuser::storageP();
	
	Exaccount::storageE();
	CDialog::OnCancel();
	CEnd endlg;
	endlg.DoModal();
	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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