?? foreignaccount.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 + -