银行管理系统源代码

  • 格式:pdf
  • 大小:48.78 KB
  • 文档页数:9

cout<<"
电话号码 :"<<phone<<endl;
cout<<"
地址 :"<<address<<endl<<endl<<endl;
cout<<" ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ }
"<<endl;
string get_id()// 取得账号
{
return id;
}
string get_mm()// 取得密码
double balance;//余额
string identity_card;// 身份证
string unit;// 单位
string phone;// 电话号码
string address;//地址
public:
user()//不带参数的构造函数
{
id='0';
mm='0';
name='0';
{
return mm;
}
int get_balance()// 取得余额
{
return balance;
}
void add_money(double x)// 通过公有成员函数访问私有成员
{
balance=x+balance;
}
void dec_money(double x)
{
balance=balance-x;
void transfer_accounts(int a);// 转账函数
void enter();// 登录函数
void menu();// 菜单函数
void exit_yinhang();// 退出函数
void save();
void load();
protected:
static int amount;// 静态成员,用于统计银行账户数
if(id1==account[i]->get_id()) {
m=1; } } if(m) { cout<<" 本账号已经存在 !"<<endl; return; } cout<<" 请输入密码: "; cin>>mm1; cout<<" 请输入姓名: "; cin>>name1; cout<<" 请输入存入金额 :"; cin>>balance1; while(balance1<0) { cout<<" 请输入正确的数字 !"<<endl; cout<<" 请重新输入 :"; cin>>balance1; } cout<<" 请输入开户人身份证 :"; cin>>identity_card1; cout<<" 请输入工作单位 :"; cin>>unit1; cout<<" 请输入电话号码 :"; cin>>phone1; cout<<" 请输入地址 :"; cin>>address1; cout<<" 开户成功 !"<<endl; user *u=new user(id1,mm1,name1,balance1,identity_card1,unit1,phone1,address1); account[amount]=u;
}
void yinhang::load()
{
祁鹏涛 银行账户信息 .txt",ios::in);
int n;
for(n=0;n<amount;n++)
{
i>>account[n]->id;// 读取账号
i>>account[n]->mm;
i>>account[n]->name;
i>>account[n]->balance;
}
};
void yinhang::save()
{
祁鹏涛 银行账户信息 .txt",ios::out);
int n=0;
for(n=0;n<amount;n++)
{
o<<account[n]->id<<endl;// 写入账号
o<<account[n]->mm<<endl;
o<<account[n]->name<<endl;
user *account[100];// 账户数 };
int yinhang::amount=0;// 静态成员赋值,初始为 0
class user:public yinhang{ // 用户类
private:
string id;// 账号
string mm;// 密码 string name;// 姓名
} friend class yinhang;// 声明 yinhang 类是 user 的友元类 void save_money();// 存钱函数 void fetch_money();// 取钱函数 void show()// 显示函数 {
system("cls"); cout<<endl;
cout<<" ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
i>>account[n]->identity_card;
i>>account[n]->unit;
i>>account[n]->phone;
i>>account[n]->address;
}
i.close();
}
void yinhang::set_account() {
//开户函数的定义
string id1;
balance1,string
identity_card1,string
{ id=id1; mm=mm1; name=name1; balance=balance1; identity_card=identity_card1; unit=unit1; phone=phone1; address=address1;
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class user;
// 声明用户类
class yinhang{
// 银行类
public:
void set_account();// 开户函数
void del_account();// 销户函数
o<<account[n]->balance<<endl;
o<<account[n]->identity_card<<endl;
o<<account[n]->unit<<endl;
o<<account[n]->phone<<endl;
o<<account[n]->address<<endl;
}
o.close();
"<<endl<<endl<<en
dl;
cout<<"
姓名 :"<<name<<endl;
cout<<"
账号 :"<<id<<endl;
cout<<"
余额 :"<<balance<<endl;
cout<<" cout<<"
身份证 :"<<y_card<<endl; 单位 :"<<unit<<endl;
balance=0;
identity_card='0';
unit='0';
phone='0';
address='0';
}
user(string id1,string mm1,string name1,double
unit1,string phone1,string address1) // 带参数的构造函数
string mm1;
string name1; double balance1; string identity_card1; string unit1; string phone1; string address1; cout<<" 请输入开户人账号: "; cin>>id1; int m=0; for(int i=0;i<amount;i++) {