AcountList.cpp
资源名称:ATM.rar [点击查看]
上传用户:szmwdq
上传日期:2022-07-16
资源大小:528k
文件大小:1k
源码类别:
金融证券系统
开发平台:
Visual C++
- // AcountList.cpp: implementation of the AcountList class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "AcountList.h"
- #include "creditCard.h"
- #include "RoseCard.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- void AcountList::Add (BankCard& a)
- {//增加账户
- Node* pN=new Node(&a);
- if (first==NULL) {
- first=pN;
- }
- else{
- pN->next=first;
- first=pN;
- }
- size++;
- }
- void AcountList::display()const{//显示
- cout<<"There are "<<size<<" BankCard custom.n";
- for(Node* pN=first; pN!=NULL; pN=pN->next)
- {
- (pN->bankt)->display();
- }
- }
- BankCard* AcountList::find(string CardNum)const
- {//查找
- for(Node* pN=first; pN!=NULL; pN=pN->next)
- {
- if ((pN->bankt)->getNum()==CardNum) {
- return (pN->bankt);
- }
- }
- return NULL;
- }
- void AcountList::deposit(string vno,double vm)
- {//存款
- BankCard* p=find(vno);
- if (p!= NULL) {
- p->deposit(vm);
- } else {cout<< "账户" <<vno<< "不存在" <<endl;}
- }
- void AcountList::withdrawal(string vno,double vm)
- {//取款
- BankCard* p=find(vno);
- if (p!=NULL) {
- p->withdrawal(vm);
- } else {cout<< "账 户" <<vno<< "不存在" <<endl;}
- }
- AcountList::~AcountList(){//析构
- Node* pN=NULL;
- while(first!=NULL)
- {
- pN=first;
- first=first->next;
- delete pN; pN=NULL;
- }
- }