精华内容
下载资源
问答
  • 2022-05-07 00:07:56

    C++个人银行账户管理系统

    采用C+ +面向对象的程序设计方法开发基于ATM的个人银行账户管理系统,根据大家的日常经验设计、实现以下功能(但不限于) :
    (1) 管理个人账户Account (基类)基本信息,比如帐号、密码、姓名、性别、住址、电话、身份证号等,登录时进行帐号和密码验证;
    (2)账户的基本功能有新建、登录、存款、取款、余额查询、利息计算等,设计这些功能时注意实际使用中的有效性约束;
    (3)系统可以动态管理多个帐户:
    (4)帐户分为多种类型,如储蓄帐户Debit (存款有利息,不可透支)和信用卡帐户Credit (可以透支,存款无利息),后者还可以进- -步划分消费等级,如普通账户和VIP账户等,另外还有兼具储蓄和透支功能的复合卡Compcard,使用继承、派生和多态等机制来设计;
    (5)将银行ATM设计成一一个组合类,支持帐户的创建、撤销、登录和退出以及银行侧的统计、查询等管理功能;
    (6)为系统设计尽量完整、方便的输入输出界面,对输入信息实现初步的有效性检查,帐户信息可通过磁盘文件进行保存和读取;
    (7)可尝试使用图形化界面类库MFC或QT进行窗口形式的界面开发,以实现更丰富的信息显示和更直观的交互操作(加分项)。
    可以采用逐步细化的迭代式开发方法,结合本课程的学习内容,丰富和完善相应功能,尽可能多的使用面向对象机制,最终成果提交要求:
    (1)完整的源程序和数据文件,对所设计的类体、函数和变量等标注必要的注释,建议使用多文件结构,包括cpp文件、.h头文件、数据文件以及项目文件等;
    (2)软件设计和使用说明书,包括功能和特色简介、基于UML的类图,主程序流程图、测试实例和运行结果(屏幕截图)等,以word文 件形式保存;
    (3)将上述文件以压缩包的形式上传。

    源码下载

    链接:https://pan.baidu.com/s/1Ov5TR_OXoQ-0Y-266Hv-8A?pwd=1111
    提取码:1111

    更多相关内容
  • 期末 C++ 课程设计作业。 使用C++完成一个银行账户管理系统
  • 银行账户管理系统 c++

    2018-06-13 11:20:58
    银行账户管理系统,使用vs2015写的,系统功能包括增加用户,删除用户,修改账户余额,用户需要账号密码登陆,需要做C++课程设计的可以拿去看看。
  • 银行账户管理系统C++

    2012-10-20 10:18:42
    银行账户管理程序 主要内容: 问题描述 设计一个银行账户管理程序,账户的信息有账号(唯一)、姓名、余额、身份证号码、单位、电话号码、地址等, 允许用户进行如下操作:开户、销户、存款、取款、转账、查询...
  • 程序包含功能: 实现储户开户、储户销户、账户登陆、修改密码、存取款、转账、查找账户 主菜单 开户(创建姓名、账号、密码) 登陆(获取账号、密码转到用户操作界面){包含... 查询(遍历所有账户信息) 退出程序
  • 北科C++课程实现个人银行账户管理系统的实验报告。北科C++课程实现个人银行账户管理系统的实验报告。北科C++课程实现个人银行账户管理系统的实验报告。北科C++课程实现个人银行账户管理系统的实验报告
  • c++的文件,派生等写出一个银行账户管理系统的课设,vs2019运行,不需要配置环境复制就可以用
  • 银行账户管理系统c++课程设计报告.doc
  • 1.Java用包package来管理处存文件 2.C++中不可更改的函数用const,但Java中没有const,用final表示该函数不可重写 3.Java中函数声明与函数体不能分离(除抽象类,接口等) 4.cout与System.out.println(变量名 + ...

    PersonalBank1

    1.Java用包package来管理处存文件
    2.C++中不可更改的函数用const,但Java中没有const,用final表示该函数不可重写
    3.Java中函数声明与函数体不能分离(除抽象类,接口等)
    4.cout与System.out.println(变量名 + “字符串”);
    5.c++ 里面建立类的对象可以直接:类名 对象名(参数),而Java里面需要:类名 对象名 = new 类名(参数)
    6.Java里是不用写什么math.h等头文件的,类库里都有。比如取整:Math.floor()
    7.Java没有id(id);,有this.id=id;

    PersonalBank2

    相比于第一个版本,增加了total变量
    其余无变化

    PersonalBank3

    增加了Date类

    1.C++ void record(const Date &date, double amount, const std::string &desc);
    Java private void record(Date date,double amount,String desc){};
    2.C++

    namespace {	//namespace使下面的定义只在当前文件中有效
    	//存储平年中某个月1日之前有多少天,为便于getMaxDay函数的实现,该数组多出一项
    	const int DAYS_BEFORE_MONTH[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
    }
    

    Java

    public final int DAYS_BEFORE_MONTH[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
    

    3.敲SavingAccount类时,利用Date方法总是报错,由于设置了void,没办法匹配?‍

    PersonalBank4

    与之前版本相比,增加了Accumulator类、Account类、CreditAccount类,SavingAccount类继承了Account类
    Date类与之前一样
    CreditAccount继承了Account,要重写show()函数,但Account中show()函数是由final修饰的

    PersonalBank5

    Date类中少了一个distance()函数,多了一个重载

    int operator - (const Date& date) const {
    		return totalDays - date.totalDays;
    	}
    

    Accumulator类与前一样
    Account类变成了抽象类,其中多了deposit、withdraw、settle函数(C++中的虚函数)
    SavingsAccount类中多了deposit、withdraw、settle

    主函数C++与Java变化对比

    cin >> cmd;
    switch (cmd) {
    		case 'd':	//存入现金
    			cin >> index >> amount;
    			getline(cin, desc);
    			accounts[index]->deposit(date, amount, desc);
    			break;
    		case 'w':	//取出现金
    			cin >> index >> amount;
    			getline(cin, desc);
    			accounts[index]->withdraw(date, amount, desc);
    			break;
    		case 's':	//查询各账户信息
    			for (int i = 0; i < n; i++) {
    				cout << "[" << i << "] ";
    				accounts[i]->show();
    				cout << endl;
    			}
    			break;
    		case 'c':	//改变日期
    			cin >> day;
    			if (day < date.getDay())
    				cout << "You cannot specify a previous day";
    			else if (day > date.getMaxDay())
    				cout << "Invalid day";
    			else
    				date = Date(date.getYear(), date.getMonth(), day);
    			break;
    		case 'n':	//进入下个月
    			if (date.getMonth() == 12)
    				date = Date(date.getYear() + 1, 1, 1);
    			else
    				date = Date(date.getYear(), date.getMonth() + 1, 1);
    			for (int i = 0; i < n; i++)
    				accounts[i]->settle(date);
    			break;
    		}
    
    cmd = (char)System.in.read();
    switch (cmd) {
    			case 'd':	//存入现金
    				index = in.nextInt();
    				amount = in.nextDouble();
    				desc = in.nextLine();
    				accounts[index].deposit(date, amount, desc);
    				break;
    			case 'w':	//取出现金
    				index = in.nextInt();
    				amount = in.nextDouble();
    				desc = in.nextLine();
    				accounts[index].withdraw(date, amount, desc);
    				break;
    			case 's':	//查询各账户信息
    				for (int i = 0; i < n; i++) {
    					System.out.print("[" + i + "] ");
    					accounts[i].show();
    					System.out.println();
    					if(i<(n-1)) {System.in.read();}
    				}
    				break;
    			case 'c':	//改变日期
    				day = in.nextInt();
    				if (day < date.getDay())
    					System.out.print("You cannot specify a previous day");
    				else if (day > date.getMaxDay())
    					System.out.print("Invalid day");
    				else
    					date = new Date(date.getYear(), date.getMonth(), day);
    				break;
    			case 'n':	//进入下个月
    				if (date.getMonth() == 12)
    					date = new Date(date.getYear() + 1, 1, 1);
    				else
    					date = new Date(date.getYear(), date.getMonth() + 1, 1);
    				for (int i = 0; i < n; i++) {
    					accounts[i].settle(date);
    					if(i<(n-1)) {System.in.read();}
    				}
    				break;
    

    PersonalBank6

    与之前版本相比较,仅主函数不同

    展开全文
  • //所有账户的总金额 //供派生类调用的构造函数,id为账户 protected Account(final Date date, final String id) { this.id=id; balance=0; date.show(); System.out.println("\t#" + id + " created...

    第八章
    1.这次把Account写成了抽象类,里面有几个虚抽象函数,在子类中实现了。
    2.批量操作和统一接口,因为对象类型不一样,还要求统一实现,就用到虚函数,而函数接口设置为一样,在函数体额外加判断条件,来达到接口统一,更利于程序的封装性,安全性。
    3.java里面的输出,也是调用类库,比如java.text.DecimalFormat可以控制输出小数点,java.io.IOException和java.util.*则是输入的专用库,每种类型的输入还不一样。
    4.在Run里面定义输入变量cmd是char,cmd = (char)System.in.read()。 这时候可能发生异常所以有抛出声明throws IOException。

    package ob5;
    
    public class Date {
    	//日期类
    		private int year;		//年
    		private	int month;		//月
    		private	int day;		//日
    		private	int totalDays;	//该日期是从公元元年1月1日开始的第几天
    		
    		
    		public	int[] DAYS_BEFORE_MONTH =new int[]{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
    		public	void show(){
    			System.out.println( getYear()+"-"+getMonth()+"-"+getDay());
    		}		//输出当前日期
    		public Date(int year, int month, int day){
    			this.year=year;
    			this.month=month;
    			this.day=day;
    			if (day <= 0 || day > getMaxDay()) {
    				System.out.println( "Invalid date: ");
    				show();
    				System.out.println();
    				System.exit(1);
    			}
    			int years = year - 1;
    			totalDays = years * 365 + years / 4 - years / 100 + years / 400
    				+ DAYS_BEFORE_MONTH[month - 1] + day;
    			if (isLeapYear() && month > 2) totalDays++;
    			
    		}//用年、月、日构造日期
    		public	int getYear() { return year; }
    		public	int getMonth() { return month; }
    		public	int getDay() { return day; }
    		public	int getMaxDay(){
    			if (isLeapYear() && month == 2)
    				return 29;
    			else
    				return DAYS_BEFORE_MONTH[month]- DAYS_BEFORE_MONTH[month - 1];
    		} //获得当月有多少天
    		public	boolean isLeapYear()  {	//判断当年是否为闰年
    				return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
    			}
    		
    			//计算两个日期之间差多少天	
    		public	int distance(Date date) {
    				return totalDays - date.totalDays;
    			}
    
    }
    
    
    package ob5;
    import java.text.DecimalFormat;
    
    abstract public class Account {//账户类
    
    	private String id;	//帐号
    	private double balance;	//余额
    	private static double total = 0; //所有账户的总金额
    	
    		//供派生类调用的构造函数,id为账户
    	protected Account(final Date date, final String id)
    	{
    		this.id=id;
    		balance=0;
    		date.show();
    		System.out.println("\t#" + id + " created");
    	}
    		//记录一笔帐,date为日期,amount为金额,desc为说明
    	protected void record(final Date date, double amount, final String desc)
    	{
    		amount = Math.floor(amount * 100 + 0.5) / 100;	//保留小数点后两位
    		balance += amount;
    		total += amount;
    		date.show();
    		System.out.println( "\t#" + id + "\t" + amount + "\t" + balance + "\t" + desc );
    	}
    		//报告错误信息
    	protected void error(final String msg)
    	{
    		System.out.println("Error(#" + id + "):" + msg);
    	}
    	
    	static DecimalFormat df = new DecimalFormat("0.0");//限制位数
    	public final String getId() { return id; }
    	public double getBalance() { return balance; }
    	public static double getTotal() { return total; }
    		//显示账户信息
    	
    	abstract void deposit(final Date date, double amount,final String desc);
    	//取出现金,date为日期,amount为金额,desc为款项说明
    	abstract void withdraw(final Date date, double amount,final String desc);
    	//结算(计算利息、年费等),每月结算一次,date为结算日期
    	abstract void settle(final Date date);
    	//显示账户信息
    	public void show()
    	{
    		System.out.print(id + "\tBalance: " + df.format(balance));
    	}
    
    }
    
    public class CreditAccount extends Account{//信用账户类
    
    	private Accumulator acc;	//辅助计算利息的累加器
    	private double credit;		//信用额度
    	private double rate;		//欠款的日利率
    	private double fee;			//信用卡年费
    
    	private double getDebt() {	//获得欠款额
    			double balance = getBalance();
    			return (balance < 0 ? balance : 0);
    	}
    	
    		//构造函数
    	public CreditAccount(final Date date,final String id, double credit, double rate, double fee)
    	{
    		super(date, id);
    		this.credit=credit;
    		this.rate=rate;
    		this.fee=fee;
    		acc = new Accumulator(date, 0);
    		
    	}
    	public double getCredit() { return credit; }
    	public double getRate() { return rate; }
    	public double getFee() { return fee; }
    	public double getAvailableCredit() {	//获得可用信用
    			if (getBalance() < 0) 
    				return credit + getBalance();
    			else
    				return credit;
    		}
    		//存入现金
    	public void deposit(final Date date, double amount,final String desc)
    	{
    		record(date, amount, desc);
    		acc.change(date, getDebt());
    	}
    		//取出现金
    	public void withdraw(final Date date, double amount,final String desc)
    	{
    		if (amount - getBalance() > credit) {
    			error("not enough credit");
    		} else {
    			record(date, -amount, desc);
    			acc.change(date, getDebt());
    		}
    	}
    		//结算利息和年费,每月1日调用一次该函数
    	public void settle(final Date date)
    	{
    		double interest = acc.getSum(date) * rate;
    		if (interest != 0)
    			record(date, interest, "interest");
    		if (date.getMonth() == 1)
    			record(date, -fee, "annual fee");
    		acc.reset(date, getDebt());
    	}
    	public void show()
    	{
    		super.show();
    		System.out.print( "\t\tAvailable credit:" + getAvailableCredit());
    	}
    }
    
    package ob5;
    
    public class SavingsAccount extends Account {
    	//储蓄账户类
    	private Accumulator acc;	//辅助计算利息的累加器
    	private double rate;		//存款的年利率
    	
    		//构造函数
    	public SavingsAccount(final Date date,final String id, double rate)
    	{
    		super(date,id);
    		this.rate = rate;
    		acc=new Accumulator(date,0);
    	}
    	public double getRate() { return rate; }
    		//存入现金
    	public void deposit(final Date date, double amount,final String desc)
    	{
    		record(date, amount, desc);
    		acc.change(date, getBalance());
    	}
    		//取出现金
    	public void withdraw(final Date date, double amount,final String desc)
    	{
    		if (amount > getBalance()) {
    			error("not enough money");
    		} else {
    			record(date, -amount, desc);
    			acc.change(date, getBalance());
    		}
    	}
    		//结算利息,每年1月1日调用一次该函数
    	public void settle(final Date date)
    	{
    		if(date.getMonth() == 1) {
    			double interest = acc.getSum(date) * rate / date.distance(new Date(date.getYear() - 1, 1, 1));	//计算年息
    			//计算年息
    		if (interest != 0)
    			record(date, interest, "interest");
    		acc.reset(date, getBalance());
    	}
    	}
    
    }
    package ob5;
    
    public class Accumulator {//将某个数值按日累加
    
    	private Date lastDate;	//上次变更数值的时期
    	private double value;	//数值的当前值
    	private double sum;		//数值按日累加之和
    	
    		//构造函数,date为开始累加的日期,value为初始值
    	public Accumulator(final Date date, double value)
    	{
    		lastDate=date;
    		this.value=value;
    		sum=0;
    	}
    		//获得到日期date的累加结果
    	public double getSum(final Date date){
    			return sum + value * date.distance(lastDate);
    		}
    
    		//在date将数值变更为value
    	public void change(final Date date, double value) {
    			sum = getSum(date);
    			lastDate = date;
    			this.value = value;
    		}
    
    		//初始化,将日期变为date,数值变为value,累加器清零
    	public void reset(final  Date date, double value) {
    			lastDate = date;
    			this.value = value;
    			sum = 0;
    		}
    
    }
    
    package ob5;
    import java.text.DecimalFormat;
    import java.util.*; 
    import java.io.IOException;
    public class Run {
    	public static void main(String[] args) throws IOException  {
    		Date date = new Date(2008, 11, 1);	//起始日期
    		//建立几个账户
    		SavingsAccount sa1 = new SavingsAccount(date, "S3755217", 0.015);
    		SavingsAccount sa2 = new SavingsAccount(date, "02342342", 0.015);
    		CreditAccount ca = new CreditAccount(date, "C5392394", 10000, 0.0005, 50);
    		Account accounts[] = { sa1, sa2, ca };
    		final int n = accounts.length;	//账户总数
    
    		System.out.println("(d)deposit (w)withdraw (s)show (c)change day (n)next month (e)exit");
    		char cmd;
    		Scanner in=new Scanner(System.in); //使用Scanner类定义对象
    		int index, day;
    		double amount;
    		String desc;
    		DecimalFormat df = new DecimalFormat("0.0");
    		do {
    			//显示日期和总金额
    			date.show();
    			System.out.print("\tTotal: " + df.format(Account.getTotal()) + "\tcommand> ");
    
    			cmd = (char)System.in.read();
    			switch (cmd) {
    			case 'd':	//存入现金
    				index = in.nextInt();
    				amount = in.nextDouble();
    				desc = in.nextLine();
    				accounts[index].deposit(date, amount, desc);
    				break;
    			case 'w':	//取出现金
    				index = in.nextInt();
    				amount = in.nextDouble();
    				desc = in.nextLine();
    				accounts[index].withdraw(date, amount, desc);
    				break;
    			case 's':	//查询各账户信息
    				for (int i = 0; i < n; i++) {
    					System.out.print("[" + i + "] ");
    					accounts[i].show();
    					System.out.println();
    					if(i<(n-1)) {System.in.read();}
    				}
    				break;
    			case 'c':	//改变日期
    				day = in.nextInt();
    				if (day < date.getDay())
    					System.out.print("You cannot specify a previous day");
    				else if (day > date.getMaxDay())
    					System.out.print("Invalid day");
    				else
    					date = new Date(date.getYear(), date.getMonth(), day);
    				break;
    			case 'n':	//进入下个月
    				if (date.getMonth() == 12)
    					date = new Date(date.getYear() + 1, 1, 1);
    				else
    					date = new Date(date.getYear(), date.getMonth() + 1, 1);
    				for (int i = 0; i < n; i++) {
    					accounts[i].settle(date);
    					if(i<(n-1)) {System.in.read();}
    				}
    				break;
    			}
    		} while (cmd != 'e');
    		in.close();
    	}
    	
    
    }
    
    
    展开全文
  • 关于个人银行账户管理系统的简单程序,主要是活期账户管理.
  • 实现一个简单的银行管理系统,完成用户的开户,开卡,存款,取款和转账业务。 2.基本要求 (1)至少包含5个类(包含必要的构造函数和析构函数),使用面向对象程序设计思想实现; (2)要用到继承与派生,要用到...
  • 具体问题 客户账户管理:输入数据建立客户账户表、分账号表,添加、删除、修改、查询客户和账户信息(参考通讯录和广义表) 我的解答思路和尝试过的方法 打算用类似于邻接表的方式,前面的数组存主账户,后面接链表...
  • 可以进行长整型运算的银行账户管理系统c++大作业。
  • C++基于ATM的个人银行账户管理系统

    千次阅读 多人点赞 2020-05-07 17:15:54
    C++基于ATM的个人银行账户管理系统

    继承层次结构

    Account作为基类,存储基本信息
    Debit为储蓄卡账户
    Credit为信用卡账户,结构体privilege将Credit分为common账户和vip账户
    ATM管理这两类账户,同时将信息记录在文件
    在这里插入图片描述

    程序主要功能

    在这里插入图片描述
    注意:

    1. 姓名与地址没有使用按行输入,不允许出现空格
    2. 账户、密码以及银行管理员密码等数字,不允许以0开头
      其中账户、密码、银行管理员密码最多10位
      电话号固定11位,身份证号固定18位,且不能出现字母
    3. 个别设计较为繁琐,还有很多地方存在漏洞,只进行了简单的验证

    程序存在的问题:

    1. 开始时思路并不是特别清晰,导致程序结构和设计上还存在些问题
    2. 为了代码重用,使用多层次的继承结构,但是在继承类中不可避免使用基类私有成员,这就不可避免使用友元,所以以牺牲了部分程序的封装性,以及模块化为代价,在程序设计时需要仔细斟酌。
    /**
    *
    *@file     ATM.cpp
    *@date     2020/5/5
    **/
    
    #include<iostream>
    #include<fstream>
    #include<cstdlib>
    #include<string>
    #include<vector>
    #include<iomanip>
    #include<iterator>
    using namespace std;
    
    const char *filename1 = "debitClient.txt";     //储蓄卡客户文件
    const char *filename2 = "creditClient.txt";    //信用卡客户文件
    
    //个人账户基本信息
    class Account
    {
    private:
    	friend class ATM;
    	friend class Debit;
    	friend class Credit;
    	long acctnum, psword;                //账户、密码
    	long long telnum;                    //电话
    	long long idnum;                     //身份证
    	string name, addr;                   //姓名、地址(....输入时不能有空格!)
    	char sex;                            //性别(m-男,f-女)
    protected:
    	long retPsword() { return psword; }
    	long retAccount() { return acctnum; }
    public:
    	Account(long acct, long ps, string n = "null", string a = "null", long long tel = 0, long long id = 0, char s = 'f') :
    		acctnum(acct), psword(ps), name(n), addr(a), telnum(tel), idnum(id), sex(s) {}
    	~Account();
    	void createAcct();                                                                                  //账户创建
    	void perfectInfo();                                                                                 //基本信息完善
    	void showAccount() const;                                                                           //基本信息显示        
    	bool Match();                                                                                       //判断密码是否匹配,用于账户登录 
    
        //用于文件I/O的友元函数
    	friend ostream& operator<<(ostream& fout, const Debit& a);
    	friend istream& operator>>(istream& fin, Debit& a);
    	friend ostream& operator<<(ostream& fout, const Credit& a);
    	friend istream& operator>>(istream& fin, Credit& a);
    };
    
    //储蓄卡账户
    class Debit :public Account
    {
    private:
    	friend class ATM;
    	double balance;               //账户余额
    public:
    	Debit(long acct = 0, long ps = 0, double bal = 0, string n = "null", string a = "null", long tel = 0, long long id = 0, char s = 'f') :
    		Account(acct, ps, n, a, tel, id, s), balance(bal) {}
    	void Deposit();                                                                                               //存款
    	void Withdraw();                                                                                              //取款     
    	void queryBalance() const;                                                                                    //余额查询
    
    																												  //用于文件I/O的友元函数
    	friend ostream& operator<<(ostream& fout, const Debit& a);
    	friend istream& operator >> (istream& fin, Debit& a);
    };
    
    //用于限定信用卡等级及特权p1-common,p2-vip
    struct privilege {
    	string scale;              //账户等级
    	double toploan;            //账户最大透支额
    	double floorrate;          //账户最小透支利率
    	bool queueRequired;        //是否需要排队
    }p1{ "common",1000,0.2,true }, p2{ "vip",5000,0.1,false };
    
    //信用卡账户
    class Credit :public Account
    {
    private:
    	friend class ATM;
    	double balance;             //账户余额
    	double maxLoan;             //透支额度
    	double rate;                //透支利率
    	double owes;                //现有透支
    	privilege p;                //账户等级
    public:
    	Credit(long acct = 0, long ps = 0, privilege = p1, string n = "null", string a = "null", long long tel = 0, long long id = 0, char s = 'f', double bal = 0, double maxL = 500, double ra = 0.3, double owe = 0) :
    		Account(acct, ps, n, a, tel, id, s), balance(bal), maxLoan(maxL), rate(ra), owes(owe), p(p1) {}
    	void Deposit();                                                                     //存款
    	void Withdraw();                                                                    //取款
    	void Repay();                                                                       //偿还透支
    	void queryBalance() const;                                                          //余额查询
    	void showPrivilege() const;                                                         //等级和特权查询
    	void setMAXLoan();                                                                  //设置透支额度
    	void setRate();                                                                     //设置透支利率
    	void upgrade();                                                                     //账户升级
    	
    																						//用于文件I/O的友元函数
    	friend ostream& operator<<(ostream& fout, const Credit& a);
    	friend istream& operator >> (istream& fin, Credit& a);
    };
    
    //ATM
    class ATM
    {
    private:
    	static const int key;          //银行管理员密码
    	vector<Credit> Credits;        //信用卡账户管理
    	vector<Debit> Debits;          //储蓄卡账户管理
    protected:
    	void debitMenu();               //储蓄卡界面
    	void debitOperate(Debit& d);    //储蓄卡操作集合
    	void creditMenu();              //信用卡界面
    	void creditOperate(Credit& c);  //信用卡操作集合
    	bool bankAuthority();           //银行管理员授权
    	void writeFile();               //文件写入
    	void readFile();                //读取文件
    public:
    	~ATM();
    	void createDebit();             //创建储蓄卡账户
    	void createCredit();            //创建信用卡账户
    	void queryCredit();             //储蓄卡信息查询
    	void queryDebit();              //信用卡信息查询
    	void deleteDebit();             //删除储蓄卡账户
    	void deleteCredit();            //删除信用卡账户
    	void collectInfo();             //账户信息汇总
    	void loginAcct();               //账户登录
    	void menu();                    //主界面
    	void ATMfuncation();            //ATM功能
    	void disp();                    //开始界面
    	void exitdisp();                //结束界面                       
    };
    
    const int ATM::key = 215000;     //银行管理员密码
    
    //*******************************方法实现*******************************
    
    //设置浮点数输出格式
    void setFormat()
    {
    	cout << setiosflags(ios::fixed)
    		<< setprecision(2);
    }
    
    void Account::createAcct()
    {
    	cout << "新建账号:______\b\b\b\b\b\b";
    	cin >> acctnum;
    	cout << "密码:______\b\b\b\b\b\b";
    	cin >> psword;
    }
    
    void Account::perfectInfo()
    {
    	cout << "请完善账户信息:\n";
    	cout << "请输入姓名:_____________\b\b\b\b\b\b\b\b\b";
    	cin >> name;
    	cout << "请输入电话号码:_____________\b\b\b\b\b\b\b\b\b";
    	cin >> telnum;
    	cout << "请输入身份证号:______________\b\b\b\b\b\b\b\b\b\b";
    	cin >> idnum;
    	cout << "请输入家庭住址:______\b\b\b\b\b\b";
    	cin >> addr;
    	cout << "请输入性别(m for man, f for female):___\b\b\b";
    	cin >> sex;
    }
    
    Account::~Account()
    {
    	name.clear();
    	addr.clear();
    }
    
    bool Account::Match()
    {
    	long pass;
    	cout << "请输入密码:_________\b\b\b\b\b\b\b\b\b";
    	cin >> pass;
    	int cx = 4;
    	while ((pass != psword) && cx) {
    		printf("密码错误,您还剩余%d次机会。\n", cx);
    		cout << "请重新输入:_______\b\b\b\b\b\b\b";
    		cin >> pass;
    		cx--;
    	}
    	if (cx == 0 && pass != psword) {
    		cout << "登录失败。\n";
    		return false;
    	}
    	cout << "登录成功。\n";
    	return true;
    }
    
    void Account::showAccount() const
    {
    	cout << "账户:" << acctnum
    		<< "\n姓名:" << name
    		<< "\n性别:" << sex
    		<< "\n电话:" << telnum
    		<< "\n身份证号:" << idnum
    		<< "\n住址:" << addr << endl;
    }
    
    istream& operator>>(istream& fin, Debit& a)
    {
    	fin >> a.acctnum >> a.psword >> a.name >> a.sex >> a.telnum >> a.idnum >> a.addr >> a.balance;
    	return fin;
    }
    
    ostream& operator<<(ostream& fout, const Debit& a)
    {
    	fout << setiosflags(ios::fixed) << setprecision(2);
    	fout << a.acctnum << " "
    		<< a.psword << " "
    		<< a.name << " "
    		<< a.sex << " "
    		<< a.telnum << " "
    		<< a.idnum << " "
    		<< a.addr << " "
    		<< a.balance << endl;
    	return fout;
    }
    
    void Debit::queryBalance() const
    {
    	cout << "账户余额:" << balance << endl;
    }
    
    void Debit::Withdraw()
    {
    	double m;
    	cout << "请输入取款金额:___\b\b\b";
    	cin >> m;
    	if (m < 0) {
    		cout << "取款金额输入错误\n"
    			<< "取款失败。\n";
    	}
    	else {
    		if (m > balance) {
    			cout << "取款金额超过账户所剩余额\n"
    				<< "取款失败。\n";
    		}
    		else {
    			balance -= m;
    			cout << "取款成功。\n"
    				<< "账户余额:" << balance << endl;
    		}
    	}
    }
    
    void Debit::Deposit()
    {
    	double m;
    	cout << "请输入存款金额:___\b\b\b";
    	cin >> m;
    	if (m < 0) {
    		cout << "存款金额输入错误\n"
    			<< "存款取消.\n";
    	}
    	else {
    		cout << "1 for 1~2 month, rate 0.02\n"
    			<< "2 for 3~5 month, rate 0.05\n"
    			<< "3 for 6~12 month, rate 0.08\n"
    			<< "请输入存款选择:_\b";
    
    		//存款利率选择
    		int ans;
    		double rat;
    		cin >> ans;
    		if (ans < 1 && ans>3) {
    			cout << "错误选择,存款取消!\n";
    			return;
    		}
    		else if (ans == 1) rat = 0.02;
    		else if (ans == 2) rat = 0.05;
    		else if (ans == 3) rat = 0.08;
    
    		m *= (1 + rat);
    		balance += m;
    		cout << "存款成功.\n"
    			<< "账户余额:" << balance << endl;
    	}
    }
    
    ostream& operator<<(ostream & fout,const Credit & a)
    {
    	fout << setiosflags(ios::fixed) << setprecision(2);
    	fout << a.acctnum << " "
    		<< a.psword << " "
    		<< a.name << " "
    		<< a.sex << " "
    		<< a.telnum << " "
    		<< a.idnum << " "
    		<< a.addr << " "
    		<< a.balance << " "
    		<< a.maxLoan << " "
    		<< a.rate << " "
    		<< a.owes << " "
    		<< a.p.scale << " " << a.p.floorrate << " " << a.p.toploan << " " << a.p.queueRequired << endl;
    	return fout;
    }
    
    istream& operator>>(istream & fin, Credit& a)
    {
    	fin >> a.acctnum >> a.psword >> a.name >> a.sex >> a.telnum >> a.idnum >> a.addr >> a.balance
    		>> a.maxLoan >> a.rate >> a.owes >> a.p.scale >> a.p.floorrate >> a.p.toploan >> a.p.queueRequired;
    	return fin;
    }
    
    void Credit::upgrade()
    {
    	if (p.scale == "vip") {
    		cout << "账户已达最高等级,无法继续升级。\n";
    		return;
    	}
    	p = p2;
    	cout << "升级成功。\n";
    }
    
    void Credit::queryBalance() const
    {
    	cout << "账户余额:" << balance
    		<< "\t透支额度:" << maxLoan
    		<< "\t利率:" << rate
    		<< "\t透支金额:" << owes << endl;
    }
    
    void Credit::Repay()
    {
    	double owe; //偿还金额
    
    	cout << "透支金额:" << owes << "\t账户余额:" << balance << endl;
    	cout << "请输入偿还金额:__\b\b";
    	cin >> owe;
    
    	if (owe > owes) {
    		cout << "超过实际透支金额,偿还取消。\n";
    		return;
    	}
    	cout << "是否使用账户余额偿还透支(1 for Yes, 2 for No):__\b\b";
    	int ans;
    	cin >> ans;
    	if (ans != 1 && ans != 2) {
    		cout << "选择错误,偿还取消。\n";
    		return;
    	}
    
    	//使用账户余额还款
    	else if (ans == 1) 
    	{
    		//账户余额足够
    		if (balance >= owe) 
    		{
    			balance -= owe;
    			owes -= owe;
    			cout << "偿还成功。\n"
    				<< "账户余额:" << balance
    				<< "\t透支金额:" << owes << endl;
    		}
    		else 
    		{
    			//账户余额不足
    			cout << "账户余额不足,是否将剩余部分补齐(1 for Yes, 2 for No):__\b\b";
    			cin >> ans;
    			if (ans == 1) 
    			{
    				balance = 0;
    				owes -= owe;
    				cout << "偿还成功。"
    					<< "账户余额:" << balance
    					<< "\t透支金额:" << owes << endl;
    			}
    			else 
    			{
    				cout << "偿还失败。\n";
    			}
    		}
    	}
    
    	//不使用账户余额还款
    	else {
    		cout << "是否将相应数额存入账户(1 for Yes, 2 for No)__\b\b";
    		cin >> ans;
    		if (ans == 1) {
    			cout << "偿还成功。"
    				<< "账户余额:" << balance
    				<< "\t透支金额:" << owes << endl;
    		}
    		else {
    			cout << "偿还失败。\n";
    		}
    	}
    }
    
    void Credit::Withdraw()
    {
    	double m;  //取款金额
    
    	cout << "请输入取款金额:___\b\b\b";
    	cin >> m;
    
    	//取款金额小于账户余额
    	if (m <= balance) {
    		balance -= m;
    		cout << "取款成功。\n"
    			<< "账户余额:" << balance << endl;
    	}
    
    	//取款金额大于账户余额
    	else {
    		cout << "取款金额超过账户剩余,"
    			<< "是否进行透支(1 for Yes, 2 for No):___\b\b\b";
    		int ans;
    		cin >> ans;
    		if (ans == 1) {
    			if (m > (balance + maxLoan - owes)) {
    				cout << "超过透支上限,"
    					<< "取款失败。\n";
    			}
    			else {
    				double interest;   //透支利息
    				m -= balance;
    				interest = m*rate;
    				owes += m + interest;
    				balance = 0;
    				cout << "取款成功。\n"
    					<< "账户余额:" << balance
    					<< "\t透支金额:" << owes << endl;
    			}
    		}
    		else
    			cout << "取款失败。\n";
    	}
    }
    
    void Credit::Deposit()
    {
    	double m;  //存款金额
    
    	cout << "请输入存款金额:___\b\b\b";
    	cin >> m;
    	if (m < 0) {
    		cout << "存款金额输入错误\n"
    			<< "存款取消。\n";
    	}
    	else {
    		cout << "1 for 1~2 month, rate 0.02\n"
    			<< "2 for 3~5 month, rate 0.05\n"
    			<< "3 for 6~12 month, rate 0.08\n"
    			<< "请输入存款选择:_\b";
    
    		//存款利率选择
    		int ans;
    		double rat;
    		cin >> ans;
    		if (ans < 1 && ans>3) {
    			cout << "错误选择,存款取消!\n";
    			return;
    		}
    		else if (ans == 1) rat = 0.02;
    		else if (ans == 2) rat = 0.05;
    		else if (ans == 3) rat = 0.08;
    
    		m *= (1 + rat);
    		balance += m;
    		cout << "存款成功.\n"
    			<< "账户余额:" << balance << endl;
    	}
    }
    
    void Credit::showPrivilege() const
    {
    	cout << "等级:" << p.scale
    		<< "\n最高透支金额:" << p.toploan
    		<< "\n最低利率:" << p.floorrate
    		<< "\n是否需要排队:";
    	if (p.queueRequired == 0) cout << "false\n";
    	else cout << "true\n";
    }
    
    void Credit::setMAXLoan()
    {
    	double m;
    	cout << "请设置透支金额:__\b\b";
    	cin >> m;
    
    	//账户等级限定最大额度
    	if (m<0 || m > p.toploan)
    		cout << "超限,设置失败。\n";
    	else {
    		maxLoan = m;
    		cout << "设置成功。\n";
    	}
    }
    
    void Credit::setRate()
    {
    	double r;
    	cout << "利率区间" << p.floorrate << "~0.3\n";
    	cout << "设置利率:__\b\b";
    	cin >> r;
    	if (r > 0 && r < p.floorrate)
    		cout << "设置超出等级限制,设置失败。\n";
    	else if (r > 0.3 && r < 0)
    		cout << "请输入合法数字。\n";
    	else {
    		rate = r;
    		cout << "设置成功。\n";
    	}
    }
    
    void ATM::readFile()
    {
    	ifstream fin1("debitClient.txt");
    	if (!fin1) {
    		cout << "文件未打开!\n";
    		exit(EXIT_FAILURE);
    	}
    	for (Debit d; fin1 >> d;)
    		Debits.push_back(d);
    
    	ifstream fin2("creditClient.txt");
    	if (!fin2) {
    		cout << "文件未打开!\n";
    		exit(EXIT_FAILURE);
    	}
    	for (Credit d; fin2 >> d;)
    		Credits.push_back(d);
    
    	fin1.close();
    	fin2.close();
    }
    
    void ATM::writeFile()
    {
    	ofstream fout1;
    	fout1.open("debitClient.txt");
    	if (!fout1) {
    		cout << "文件未打开!\n";
    		exit(EXIT_FAILURE);
    	}
    	ostream_iterator<Debit> itrOut1(fout1);
    	copy(Debits.begin(), Debits.end(), itrOut1);
    	
    	ofstream fout2;
    	fout2.open("creditClient.txt");
    	if (!fout2) {
    		cout << "文件未打开!\n";
    		exit(EXIT_FAILURE);
    	}
    	ostream_iterator<Credit> itrOut2(fout2);
    	copy(Credits.begin(), Credits.end(), itrOut2);
    
    	fout1.close();
    	fout2.close();
    }
    
    void ATM::disp()
    {
    	readFile();
    	cout << endl << endl << endl << endl << endl;
    	cout << "                                         *******************************" << endl;
    	cout << "                                         *                             *" << endl;
    	cout << "                                         *    欢迎使用ATM存取一体机!   *" << endl;
    	cout << "                                         *                             *" << endl;
    	cout << "                                         *******************************" << endl << endl;
    	cout << "                                                    按Enter键继续!" << endl;
    	getchar();
    }
    
    void ATM::exitdisp()
    {
    	writeFile();
    	system("cls");
    	cout << endl << endl << endl << endl << endl;
    	cout << "                                         *******************************" << endl;
    	cout << "                                         *                             *" << endl;
    	cout << "                                         *    感谢您的使用!            *" << endl;
    	cout << "                                         *                             *" << endl;
    	cout << "                                         *******************************" << endl << endl;
    }
    
    bool ATM::bankAuthority()
    {
    	cout << "请输入银行管理员密码,获得授权:______\b\b\b\b\b\b";
    	int k;
    	cin >> k;
    	int cx = 4;
    	int flag = 1;
    	while (flag&&cx) {
    		if (k == key) {
    			flag = 0;
    			break;
    		}
    		printf("密码错误,您还剩余%d次机会。\n", cx);
    		cout << "请重新输入:_______\b\b\b\b\b\b\b";
    		cin >> k;
    		cx--;
    	}
    	if (flag == 1) {
    		cout << "授权失败,无法操作。\n";
    		return false;
    	}
    	cout << "授权成功,请继续操作。\n";
    	return true;
    }
    
    void ATM::debitMenu()
    {
    	system("cls");
    	cout << endl << endl << endl << endl << "                        请选择操作序号!(0~4)" << endl;
    	cout << "                           **********************************************************" << endl;
    	cout << "                           *                                                        *" << endl;
    	cout << "                           *                    0.返回主界面                        *" << endl;
    	cout << "                           *                    1.存款                              *" << endl;
    	cout << "                           *                    2.取款                              *" << endl;
    	cout << "                           *                    3.显示余额                          *" << endl;
    	cout << "                           *                    4.显示账户信息                      *" << endl;
    	cout << "                           *                                                        *" << endl;
    	cout << "                           **********************************************************" << endl;
    }
    
    void ATM::debitOperate(Debit& d)
    {
    	//进入用户界面
    	debitMenu();
    
    	int choice;
    	cout << "              请输入您的选择:";
    	cin >> choice;
    	while (choice != 0) {
    		cout << "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *\n";
    		switch (choice)
    		{
    		case 1:
    			d.Deposit();
    			break;
    		case 2:
    			d.Withdraw();
    			break;
    		case 3:
    			d.queryBalance();
    			break;
    		case 4:
    			d.showAccount();
    			break;
    		default:
    			cout << "输入错误!\n";
    		}
    		cout << "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *\n\n";
    		cout << "              请输入您的选择:";
    		cin >> choice;
    	}
    	//返回主界面
    	menu();
    }
    
    void ATM::creditOperate(Credit& c)
    {
    	//进入用户界面
    	creditMenu();
    
    	int choice;
    	cout << "              请输入您的选择:";
    	cin >> choice;
    	while (choice != 0) {
    		cout << "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *\n";
    		switch (choice)
    		{
    		case 1:
    			c.Deposit();
    			break;
    		case 2:
    			c.Withdraw();
    			break;
    		case 3:
    			c.queryBalance();
    			break;
    		case 4:
    			c.showAccount();
    			break;
    		case 5:
    			c.Repay();
    			break;
    		case 6:
    			c.showPrivilege();
    			break;
    		case 7:
    			if (bankAuthority())
    				c.setMAXLoan();
    			break;
    		case 8:
    			if (bankAuthority())
    				c.setRate();
    			break;
    		case 9:
    			if (bankAuthority())
    				c.upgrade();
    			break;
    		default:
    			cout << "输入错误!\n";
    		}
    		cout << "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *\n\n";
    		cout << "              请输入您的选择:";
    		cin >> choice;
    	}
    
    	//返回主界面
    	menu();
    }
    
    void ATM::creditMenu()
    {
    	system("cls");
    	cout << endl << endl << endl << endl << "                        请选择操作序号!(0~8)" << endl;
    	cout << "                           **********************************************************" << endl;
    	cout << "                           *                                                        *" << endl;
    	cout << "                           *                    0.返回主界面                        *" << endl;
    	cout << "                           *                    1.存款                              *" << endl;
    	cout << "                           *                    2.取款                              *" << endl;
    	cout << "                           *                    3.显示余额                          *" << endl;
    	cout << "                           *                    4.显示信息                          *" << endl;
    	cout << "                           *                    5.偿还透支                          *" << endl;
    	cout << "                           *                    6.显示信用卡等级                    *" << endl;
    	cout << "                           *                    7.设置透支额度                      *" << endl;
    	cout << "                           *                    8.设置利率                          *" << endl;
    	cout << "                           *                    9.升级                              *" << endl;
    	cout << "                           *                                                        *" << endl;
    	cout << "                           **********************************************************" << endl;
    }
    
    void ATM::queryDebit()
    {
    	cout << "输入查询账号:________\b\b\b\b\b\b\b";
    	long acct;
    	cin >> acct;
    	vector<Debit>::iterator it;
    	for (it = Debits.begin(); it != Debits.end(); it++)
    	{
    		if ((*it).retAccount() == acct) break;
    	}
    	if (it == Debits.end()) {
    		cout << "账号不存在。\n";
    		return;
    	}
    	(*it).showAccount();
    	(*it).queryBalance();
    }
    
    void ATM::queryCredit()
    {
    	cout << "输入查询账号:________\b\b\b\b\b\b\b";
    	long acct;
    	cin >> acct;
    	vector<Credit>::iterator it;
    	for (it = Credits.begin(); it != Credits.end(); it++)
    	{
    		if ((*it).retAccount() == acct) break;
    	}
    	if (it == Credits.end()) {
    		cout << "账号不存在。\n";
    		return;
    	}
    	(*it).showAccount();
    	(*it).queryBalance();
    }
    
    void ATM::collectInfo()
    {
    	cout << "\n***********************************账户基本信息表\n";
    	cout << "储蓄卡汇总:" << "\t账户个数:" << Debits.size() << "                      *\n";
    	for (auto it = Debits.begin(); it != Debits.end(); it++) {
    		cout << "账户:" << (*it).acctnum
    			<< "\t姓名:" << (*it).name << endl;
    	}
    	cout << endl;
    	cout << "信用卡汇总:" << "\t账户个数:" << Credits.size() << "                      *\n";
    	for (auto it = Credits.begin(); it != Credits.end(); it++) {
    		cout << "账户:" << (*it).acctnum
    			<< "\t姓名:" << (*it).name << endl;
    	}
    	cout << "*************************************************\n\n";
    }
    
    void ATM::deleteDebit()
    {
    	long acct, ps;
    	cout << "请输入账号:______\b\b\b\b\b\b\b";
    	cin >> acct;
    	vector<Debit>::iterator it;
    	for (it = Debits.begin(); it != Debits.end(); it++)
    	{
    		if ((*it).retAccount() == acct) break;
    	}
    	if (it == Debits.end()) {
    		cout << "账号不存在。\n";
    		return;
    	}
    	cout << "请输入密码:_______\b\b\b\b\b\b\b";
    	cin >> ps;
    	if (ps != (*it).retPsword()) {
    		cout << "密码错误,删除失败。\n";
    		return;
    	}
    	cout << "是否确认删除:___\b\b\b";
    	char ans;
    	cin >> ans;
    	if (ans == '否') {
    		cout << "取消删除。\n";
    		return;
    	}
    	Debits.erase(it);
    	cout << "删除成功。\n";
    }
    
    void ATM::deleteCredit()
    {
    	long acct, ps;
    	cout << "请输入账号:______\b\b\b\b\b\b\b";
    	cin >> acct;
    	vector<Credit>::iterator it;
    	for (it = Credits.begin(); it != Credits.end(); it++)
    	{
    		if ((*it).retAccount() == acct) break;
    	}
    	if (it == Credits.end()) {
    		cout << "账号不存在。\n";
    		return;
    	}
    	cout << "请输入密码:_______\b\b\b\b\b\b\b";
    	cin >> ps;
    	if (ps != (*it).retPsword()) {
    		cout << "密码错误,删除失败。\n";
    		return;
    	}
    	cout << "是否确认删除:___\b\b\b";
    	char ans;
    	cin >> ans;
    	if (ans == '否') {
    		cout << "取消删除。\n";
    		return;
    	}
    	Credits.erase(it);
    	cout << "删除成功。\n";
    }
    
    void ATM::loginAcct()
    {
    	cout << "请输入账号类型(c for Credit, d for Debit):___\b\b\b";
    	char t;
    	cin >> t;
    	cout << "请输入账号:_______\b\b\b\b\b\b\b\b";
    	long acct;
    	cin >> acct;
    	if (t == 'd') {
    		vector<Debit>::iterator it;
    		for (it = Debits.begin(); it != Debits.end(); it++)
    		{
    			if ((*it).retAccount() == acct) break;
    		}
    
    		if (it == Debits.end()) {
    			cout << "您所输入的账号不存在。\n";
    			return;
    		}
    		if ((*it).Account::Match())  debitOperate(*it);
    	}
    	else {
    		vector<Credit>::iterator it;
    		for (it = Credits.begin(); it != Credits.end(); it++)
    		{
    			if ((*it).retAccount() == acct) break;
    		}
    		if (it == Credits.end()) {
    			cout << "您所输入的账号不存在。\n";
    			return;
    		}
    		if ((*it).Account::Match())  creditOperate(*it);
    	}
    }
    
    void ATM::menu()
    {
    	system("cls");
    	cout << endl << endl << endl << endl << "                        请选择操作序号!(0~8)" << endl;
    	cout << "                           **********************************************************" << endl;
    	cout << "                           *                                                        *" << endl;
    	cout << "                           *                    0.退出                              *" << endl;
    	cout << "                           *                    1.创建储蓄账户                      *" << endl;
    	cout << "                           *                    2.创建信用账户                      *" << endl;
    	cout << "                           *                    3.删除储蓄账户                      *" << endl;
    	cout << "                           *                    4.删除信用账户                      *" << endl;
    	cout << "                           *                    5.查询储蓄账户                      *" << endl;
    	cout << "                           *                    6.查询信用账户                      *" << endl;
    	cout << "                           *                    7.账户登录                          *" << endl;
    	cout << "                           *                    8.账户信息汇总                      *" << endl;
    	cout << "                           *                                                        *" << endl;
    	cout << "                           **********************************************************" << endl;
    }
    
    void ATM::ATMfuncation()
    {
    	menu();
    	int choice;
    	cout << "              请输入您的选择:";
    	cin >> choice;
    	while (choice != 0) {
    		cout << "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *\n";
    		switch (choice)
    		{
    		case 1:
    			createDebit();
    			break;
    		case 2:
    			createCredit();
    			break;
    		case 3:
    			deleteDebit();
    			break;
    		case 4:
    			deleteCredit();
    			break;
    		case 5:
    			if (bankAuthority())
    				queryDebit();
    			break;
    		case 6:
    			if (bankAuthority())
    				queryCredit();
    			break;
    		case 7:
    			loginAcct();
    			break;
    		case 8:
    			if (bankAuthority())
    				collectInfo();
    			break;
    		default:
    			cout << "输入错误!\n";
    		}
    		cout << "*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *\n";
    		cout << "              请输入您的选择:";
    		cin >> choice;
    	}
    }
    
    void ATM::createDebit()
    {
    	if (Debits.size() == Debits.max_size()) {
    		cout << "储蓄卡账户已达上限。";
    		return;
    	}
    	Debit t;
    	t.createAcct();
    	vector<Debit>::iterator it;
    	for (it = Debits.begin(); it != Debits.end(); it++)
    	{
    		if ((*it).retAccount() == t.acctnum) {
    			cout << "账户已存在,新建失败。\n";
    			return;
    		}
    	}
    	if (it == Debits.end())
    		cout << "账户创建成功。\n";
    
    	//基本信息完善
    	t.perfectInfo();
    	Debits.push_back(t);
    }
    
    void ATM::createCredit()
    {
    	if (Credits.size() == Credits.max_size()) {
    		cout << "信用卡账户已达上限。";
    		return;
    	}
    	Credit t;
    	t.createAcct();
    	vector<Credit>::iterator it;
    	for (it = Credits.begin(); it != Credits.end(); it++)
    	{
    		if ((*it).retAccount() == t.acctnum) {
    			cout << "账户已存在,新建失败。\n";
    			return;
    		}
    	}
    	if (it == Credits.end())
    		cout << "账户创建成功。\n";
    
    	cout << "请输入账号等级(1 for common,2 for vip):___\b\b\b";
    	int scale;
    	cin >> scale;
    	if (scale == 1) t.p = p1;
    	else t.p = p2;
    
    	//基本信息完善
    	t.perfectInfo();
    	Credits.push_back(t);
    }
    
    ATM::~ATM()
    {
    	Credits.clear();
    	vector<Credit>().swap(Credits);
    	Debits.clear();
    	vector<Debit>().swap(Debits);
    }
    //******************************************************************
    
    int main() {
    	setFormat();
    	ATM atm;
    	atm.disp();
    	atm.ATMfuncation();
    	atm.exitdisp();
    	system("pause");
    }
    
    展开全文
  • 银行账户存储系统C++

    2022-01-17 23:04:06
    类的使用,银行账户存储。
  • c++银行账户管理系统,可执行长整型运算的操作。
  • 银行管理系统C++代码

    热门讨论 2010-05-17 15:04:17
    银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理系统C++代码银行管理...
  • 银行管理系统C++

    2017-06-10 22:41:29
    C++实现银行管理系统,支持取款、存款、转账、开户、销户、修改信息等功能,对文件进行操作。登录支持账号+密码登录和用户名+密码登录,功能完善,数据合法性检验,程序健壮。可自动获取账号、用户销户后账号可回收...
  • C++银行管理系统源代码

    千次阅读 2020-12-28 10:53:32
    相关文章推荐: 1、C语言学生成绩管理系统源代码★★★★★ 2、C语言学籍管理系统源代码★★ 3、C语言学生成绩管理系统设计...C++银行管理系统源代码: #include<iostream> #include<fstream> #inc...
  • 大二上做的,很粗糙。只能用来应付课设吧大概。
  • 代码 package W7; public class Date { //日期类 private int year; //年 private int month;... } } 总结 此版本抽象了Account类,并派生出了子类CreditAccount和SavingsAccount,语法与C++有一定不同。
  • 银行账户管理系统(c++课程设计).docx银行账户管理系统(c++课程设计).docx银行账户管理系统(c++课程设计).docx银行账户管理系统(c++课程设计).docx银行账户管理系统(c++课程设计).docx银行账户管理系统(c++课程设计)....
  • //储蓄账户类 private int id; //账号 private double balance;//余额 private double rate;//存款的年利率 private int lastDate; //上次变更余额的时期 private double accumulation; //余额按日累加...
  • 开户:动态申请空间一个,完成信息输入与分配账户到该户,并加入到链表节点的末尾 销户:查询到账户,并从链表中丢掉该节点,调用delete删除该动态申请的空间 存款:进入账号,增加余额的数量 取款:进入账号,...
  • 银行账户信息管理系统 功能要求: <p>1、具有查询帐户余额的功能 <p>2、具有简单的存取款功能 <p>3、能够实现帐户的插入、删除和修改 <p>4、具有帐户信息的保存功能</p>
  • 银行作业分享,欢迎批评指正。到第12章。 Array.h #pragma once #ifndef ARRAY_H #define ARRAY_H #include<cassert> template<class T> class Array { private: T* list; int size; public: Array...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,662
精华内容 1,464
关键字:

银行账户管理系统c++

c++ 订阅