Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
16_4.cpp
Package: c.rar [view]
Upload User: puke2000
Upload Date: 2022-07-25
Package Size: 912k
Code Size: 4k
Category:
CSharp
Development Platform:
Visual C++
- //16_4.cpp
- #include <iostream.h>
- #include "account.h"
- #include "savings.h"
- #include "checking.h"
- #include "credit.h"
- void DoSavings(int access);
- void DoChecking(int access);
- void DoAccess(int type);
- void DoCredit(int access);
- void main()
- {
- int sele=1;
- while(sele){
- cout <<"nbank managementnn"
- <<"0. Returnn"
- <<"1. Savings businessn"
- <<"2. Checking businessn"
- <<"3. Credit businessnn"
- <<"select : ";
- cin >>sele;
- if(sele>=1 && sele <=3) DoAccess(sele);
- }
- Account* p=Account::First(); //以下善后
- while(p){
- Account* t=p;
- p=p->Next();
- delete t;
- }
- Account::First()=NULL;
- }
- void DoAccess(int type)
- {
- int sele=1;
- while(sele){
- cout <<"nFetching or savingnn"
- <<"0. Returnn"
- <<"1. Fetchingn"
- <<"2. Savingnn"
- <<"select : ";
- cin >>sele;
- if(sele!=1 && sele!=2) continue;
- switch(type){
- case 1: DoSavings(sele); break;
- case 2: DoChecking(sele); break;
- case 3: DoCredit(sele); break;
- }
- }
- }
- void DoSavings(int access)
- {
- unsigned aN;
- float val;
- if(access==2){ //saving
- cout <<"nplease input some account and amount for saving(input 0 for end):n";
- cin >>aN >>val;
- while(aN && val>0){
- Account* p;
- for(p=Account::First(); p; p=p->Next()) //finding
- if(p->AccountNo()==aN && dynamic_cast<Savings*>(p)){
- p->Deposit(val);
- break;
- }
- if(!p) //not found
- new Savings(aN,val);
- cout <<"nplease input some account and amount for saving(input 0 for end):n";
- cin >>aN >>val;
- }
- }else{ //fetching
- cout <<"please input a account number and amount for fetching(input 0 for end):n";
- cin >>aN >>val;
- while(aN && val>0){
- Account* p;
- for(p=Account::First(); p; p=p->Next()) //finding
- if(p->AccountNo()==aN && dynamic_cast<Savings*>(p)){
- p->Withdrawal(val);
- break;
- }
- if(!p)
- cout <<"error: the account number isn't found.n";
- cout <<"nplease input a account number and amount for fetching(input 0 for end):n";
- cin >>aN >>val;
- }
- }
- }
- void DoChecking(int access)
- {
- unsigned aN;
- float val;
- if(access==2){ //saving
- cout <<"nplease input some account and amount for saving(input 0 for end):n";
- cin >>aN >>val;
- while(aN && val>0){
- Account* p;
- for(p=Account::First(); p; p=p->Next()) //finding
- if(p->AccountNo()==aN && dynamic_cast<Checking*>(p)){
- p->Deposit(val);
- break;
- }
- if(!p) //not found
- new Checking(aN,val);
- cout <<"nplease input some account and amount for saving(input 0 for end):n";
- cin >>aN >>val;
- }
- }else{ //fetching
- cout <<"nplease input a account number and amount for fetching(input 0 for end):n";
- cin >>aN >>val;
- while(aN && val>0){
- Account* p;
- for(p=Account::First(); p; p=p->Next()) //finding
- if(p->AccountNo()==aN && dynamic_cast<Checking*>(p)){
- p->Withdrawal(val);
- break;
- }
- if(!p)
- cout <<"error: the account number isn't found.n";
- cout <<"nplease input a account number and amount for fetching(input 0 for end):n";
- cin >>aN >>val;
- }
- }
- }
- void DoCredit(int access)
- {
- unsigned aN;
- float val;
- if(access==2){ //saving
- cout <<"please input some account and amount for saving(input 0 for end):n";
- cin >>aN >>val;
- while(aN && val>0){
- Account* p;
- for(p=Account::First(); p; p=p->Next()) //finding
- if(p->AccountNo()==aN && dynamic_cast<Creditcard*>(p)){
- p->Deposit(val);
- break;
- }
- if(!p) //not found
- new Creditcard(aN,val);
- cout <<"nplease input some account and amount for saving(input 0 for end):n";
- cin >>aN >>val;
- }
- }else{ //fetching
- cout <<"nplease input a account number and amount for fetching(input 0 for end):n";
- cin >>aN >>val;
- while(aN && val>0){
- Account* p;
- for(p=Account::First(); p; p=p->Next()) //finding
- if(p->AccountNo()==aN && dynamic_cast<Creditcard*>(p)){
- p->Withdrawal(val);
- break;
- }
- if(!p)
- cout <<"error: the account number isn't found.n";
- cout <<"nplease input a account number and amount for fetching(input 0 for end):n";
- cin >>aN >>val;
- }
- }
- }