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

📄 foreignaccount.cpp

📁 一个模仿ATM提款机的MFC程序
💻 CPP
字号:
// ForeignAccount.cpp: implementation of the ForeignAccount class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "atm.h"
#include "ForeignAccount.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

ForeignAccount *ForeignAccount::pFirstC=NULL;		//链表为空




ForeignAccount::ForeignAccount(CString accNo, CString paswrd,double Dollar=0,double Mark=0,double Yen=0)
:Account(accNo,paswrd,true,true)	//国际卡用户
{
	yen=Yen;
	mark=Mark;
	dollar=Dollar;
	if(pFirstC==NULL)
		pFirstC=this;				//空链表中建立一新帐户	
	else
	{
		ForeignAccount *ps=pFirstC;
		for (;ps->pNextC;ps=ps->pNextC);
		ps->pNextC=this;			//在最后插入本节点
		
	}
	pNextC=NULL;
	
	
}


ForeignAccount * ForeignAccount::searchNewAccount(CString paswd)
{
	ForeignAccount  *pc=pFirstC;
	if(pc==NULL)
	{
		
		return NULL;
	}
	
	for (;pc;pc=pc->pNextC)
	{
		if ((pc->checkPassword(paswd)))
		{
			
			return pc;
		}
		
	}
	return NULL;
}
ForeignAccount *ForeignAccount::searchranNewAccount(CString accountno)
{
	ForeignAccount  *pc=pFirstC;
	if(pc==NULL)
	{
		
		return NULL;
	}
	
	for (;pc;pc=pc->pNextC)
	{
		if ((pc->GetacntNo()==accountno))
		{
			
			return pc;
		}
		
	}
	return NULL;
}

void ForeignAccount::AddDollar(double amoun){
	dollar+=amoun;
}
void ForeignAccount::AddYen(double amoun){
	yen+=amoun;
}
void ForeignAccount::AddMark(double amoun){
	mark+=amoun;
}



double ForeignAccount::AcntBalan()
{
	return balance;
}


/*
void ForeignAccount::loadFile(ostream & out)
{
	Account::loadFile(out);
}
*/

bool ForeignAccount::storageC()
{
	ofstream out("国际卡帐户.txt");
	if(pFirstC==NULL)
		return 1;	
	ForeignAccount  *pc=pFirstC;		
	
				for (;pc;pc=pc->pNextC)
				{
					out << *pc ;
					
				}
				out.close();
				return true;
				
}
ostream& operator <<(ostream & out ,ForeignAccount &FA){
	FA.loadFile(out);
	out<<endl;
	return out;
}
void ForeignAccount::loadFile(ostream & out)
{
	out <<acntNumber<<' '<<password<<' '<<balance<<' '<<dollar<<' '<<mark<<' '<<yen<<' ';
}

⌨️ 快捷键说明

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