设计并实现简单的银行存取款系统,系统主界面包括登录和注册两个选项,选择登录,提示用户输入银行帐号和密码,验证通过后进入主界面,主界面包括:存款、取款、查询余额、历史记录、修改密码等功能。注册功能让用户输入账号和密码,在注册时要验证账号是否已经存在。所有数据能够保存在文件中,退出系统后再次运行系统,之前注册的用户和存款信息都存在。

#include <iostream>
#include <fstream>
#include <queue>
#include <stdlib.h>
using namespace std;
struct user;
typedef user T;
queue <T> uu;
int count=0;
struct user
{
string id;
string pass;
int n;
double *money;
user() {}
user(string id,string pass,int n,double *money):id(id),pass(pass),n(n),money(money) {}
}; int gongshow();
int gong(string newid);
int save(string newid, string newpass);
int setid(string newid,string newpass); int main()
{
system("color 0A");
while(1)
{
int m;
string newid,newpass;
cout << "\t\t\t *************************" << endl;
cout << "\t\t\t *Bank Simulation Program*" << endl;
cout << "\t\t\t *************************" << endl;
cout << "\t\t\t * *" << endl;
cout << "\t\t\t * 1.LOG IN *" << endl;
cout << "\t\t\t * 2.ENROLL *" << endl;
cout << "\t\t\t * 3.ESC *" << endl;
cout << "\t\t\t * *" << endl;
cout << "\t\t\t *************************" << endl<<endl;
cout << "\t\t\t Please enter the serial number:";
cin >> m;
if(m==3)
return 0;
system("cls");
cout << "\t\t\t *************************" << endl;
cout << "\t\t\t *Bank Simulation Program*" << endl;
cout << "\t\t\t *************************" << endl<<endl;
cout << "\t\t\t ID:";
cin >> newid;
cout << "\t\t\t PASSWORD:";
cin >> newpass;
int x=save(newid,newpass);// id 1 password 0 no_id 2
if(m==1)
if(x==1)
{
cout << "\t\t\t LOGIN SUCCESSFUL";
system ("pause>nul");
system("cls");
while(1)
{
if(gong(newid)==0) break;
int x=save(newid,newpass);
system ("pause>nul");
system("cls");
}
}
else if(x==2)
{
cout << "\t\t\t ACCOUNT DOS'T EXIST";
system ("pause>nul");
system("cls");
}
else
{
cout << "\t\t\t WRONG PASSWORD";
system ("pause>nul");
system("cls");
}
else if(m==2)
{
if(x==2)
{
if(setid(newid,newpass))
{
cout << "\t\t\t ENROLL SUCCESS";
while(1)
{
while(!uu.empty()) uu.pop();
int x=save(newid,newpass);
system ("pause>nul");
system("cls");
if(gong(newid)==0) break;
}
}
else
{
cout << "\t\t\t ENROLL FAILURE";
system ("pause>nul");
system("cls"); }
}
else if(x==1)
{
cout << "\t\t\t ACCOUNT ALREADY EXISTS";
system ("pause>nul");
system("cls"); }
system("cls");
}
}
return 0;
} int gongshow()
{
cout << "\t\t\t *************************" << endl;
cout << "\t\t\t *Bank Simulation Program*" << endl;
cout << "\t\t\t *************************" << endl;
cout << "\t\t\t * *" << endl;
cout << "\t\t\t * 1.DPOSIT *" << endl;
cout << "\t\t\t * 2.WITHDRAWALS *" << endl;
cout << "\t\t\t * 3.CHECK BALANCES *" << endl;
cout << "\t\t\t * 4.HISTORY RECORD *" << endl;
cout << "\t\t\t * 5.CHANGE PASSWORD *" << endl;
cout << "\t\t\t * 6.ESC *" << endl;
cout << "\t\t\t * *" << endl;
cout << "\t\t\t *************************" << endl;
cout << endl << "\t\t\t Please enter the serial number:";
int n;
cin >>n;
return n;
} int gong(string newid)
{ int n=gongshow();
if(n==2||n==1||n==5)
{
fstream f("ios.txt",ios::out);
if(n==1)
{
double n=0;
cout << "\t\t\t Enter deposit amount:";
cin >> n;
while(!uu.empty())
{
if(uu.front().id==newid)
{
f<<uu.front().id<<' '<<uu.front().pass<<' '<<uu.front().n+1<<' ';
for(int i=0; i<uu.front().n; i++)
{
f<< uu.front().money[i]<<' ';
}
f<< uu.front().money[uu.front().n-1]+n<< endl;
cout << "\t\t\t Deposit has been successful";
}
else
{
f<<uu.front().id<<' '<<uu.front().pass<<' '<<uu.front().n<<' ';
for(int i=0; i<uu.front().n; i++)
{
f<< uu.front().money[i]<<' ';
}
f<<endl;
}
uu.pop();
count--;
if(count==1)
uu.pop();
}
}
if(n==2)
{
double n=0;
cout << "\t\t\t Enter the withdrawal amount:";
cin >> n;
while(!uu.empty())
{
if(uu.front().id==newid&&uu.front().money[uu.front().n-1]-n>=0)
{
f<<uu.front().id<<' '<<uu.front().pass<<' '<<uu.front().n+1<<' ';
for(int i=0; i<uu.front().n; i++)
{
f<< uu.front().money[i]<<' ';
}
f<< uu.front().money[uu.front().n-1]-n<< endl;
f<< endl;
cout << "\t\t\t Withdrawals success";
}
else if(uu.front().id!=newid)
{
f<<uu.front().id<<' '<<uu.front().pass<<' '<<uu.front().n<<' ';
for(int i=0; i<uu.front().n; i++)
{
f<< uu.front().money[i]<<' ';
}
f<<endl;
}
else if(uu.front().id==newid&&uu.front().money[uu.front().n-1]-n<0)
{
f<<uu.front().id<<' '<<uu.front().pass<<' '<<uu.front().n<<' ';
for(int i=0; i<uu.front().n; i++)
{
f<< uu.front().money[i]<<' ';
}
f<<endl;
cout << "\t\t\t INSUFFICIENT BALANCE\n";
}
uu.pop();
count--;
if(count==1)
uu.pop();
} }
else if(n==5)
{
string newpass;
cout << "\t\t\t Please enter a new password:";
cin >> newpass;
while(!uu.empty())
{
if(uu.front().id==newid)
{
f<<uu.front().id<<' '<<newpass<<' '<<uu.front().n<<' ';
for(int i=0; i<uu.front().n; i++)
{
f<< uu.front().money[i]<<' ';
}
f<< uu.front().money[uu.front().n-1]<< endl;
}
uu.pop();
count--;
if(count==1)
uu.pop();
}
cout << "\t\t\t PASSWORD RESET COMPLETE\n";
}
f.close();
}
else if(n==3)
{
while(!uu.empty())
{
if(uu.front().id==newid)
{
cout << "\t\t\t BALANCES:" << uu.front().money[uu.front().n-1]<<endl;
}
uu.pop();
}
}
else if(n==4)
{
while(!uu.empty())
{
if(uu.front().id==newid)
{
cout<<"\t\t\t ID:"<<uu.front().id<<endl;
for(int i=1; i<uu.front().n; i++)
{
cout<<"\t\t\t ";
double difference=uu.front().money[i]-uu.front().money[i-1];
if(difference>0)
cout<<'+';
cout<<difference<<endl;
}
if(uu.front().n==1) cout<<"\t\t\t NO RECORD";
}
uu.pop();
}
}
else if(n==6)
{
system("cls");
return 0;
}
return 1;
} int save(string newid, string newpass)
{
count=0;
int flog=2;
fstream fi;
fi.open("ios.txt",ios::in);
if(!fi)
{
fi.open("ios.txt",ios::out);
fi.close();
fi.open("ios.txt",ios::in);
}
while(!fi.eof())
{
double *money=new double;
user a;
fi >> a.id >> a.pass >> a.n;
if(a.id==newid)
if(a.pass==newpass)
flog=1;
else
return 0;
for(int j =0; j<a.n; j++)
{
fi >> money[j];
}
a.money=money;
uu.push(a);
count++;
}
fi.close();
return flog;
} int setid(string newid,string newpass)
{
fstream fi("ios.txt",ios::app|ios::out);
int n=1;
double x=0.0;
fi<< newid << ' ' << newpass << ' ' << n << ' ' << x <<endl ;
fi.close();
return 1;
}

到这里就写完了 :) .

Bank Simulation Program银行管理系统C++ :)的更多相关文章

  1. python 银行管理系统

    这是一个使用python连接mysql的例子 涉及到类的使用 import pymysql import function as f def mysql(): db=pymysql.connect(h ...

  2. 银行管理系统[C++]

    //项目:银行管理系统 //系统实现的主要有管理,取款机管理,用户查询等功能: //*管理模块:存款.取款.开户.销户.修改信息.办卡.挂失卡; //*用户查询模块; //*取款机信息管理模块:管理员 ...

  3. c++ 银行管理系统及报告

    1.题目描写叙述: 本代码为银行管理系统,总体分为管理员模式和普通用户模式: (1)在管理员模式中能完毕 ①用户信息录入 ②改动管理员password ③改动指定账户信息 ④信息管理业务 (2)在普通 ...

  4. java实现银行管理系统

    Bank类 package First; import java.util.TreeSet; //银行类public class Bank {        private String Bankna ...

  5. python连接mysql数据库实例demo(银行管理系统数据库版)

    主函数: import adminView import os import pickle from bankFunction import BankFunction import time def ...

  6. Dark Mobile Bank之移动银行应用仿冒攻击威胁分析报告

    一.背景 据“第十五次全国信息网络安全状况暨计算机和移动终端病毒疫情调查”调查结果显示,2015年移动终端的病毒感染比例为50.46%,相对于2014年增长了18.96%,移动终端病毒感染率涨幅较大, ...

  7. 我的Java语言学习日志1_"简单的银行管理系统实现"

    设计步骤:注意:本篇代码,直接建两个类( Bank_Account.BankManage)在BankManage往里面填方法就行.是为了让和我一样自学朋友可以更快的接受.但是代码优化的空间还是很大的( ...

  8. JavaSwing开发简单的银行管理系统 附源码

    开发环境: Windows操作系统开发工具: MyEclipse/Eclipse+Jdk+mysql数据库 运行效果图:

  9. 基于Java的简单银行管理系统(MVC设计模式)

    项目导航 功能展示 项目描述 项目结构 `data` `service` `utils` `view ` 欠缺与总结 源码下载 功能展示 本系统基于命令台窗口,暂未与图形页面结合.话不多说,先上效果图 ...

随机推荐

  1. 使用PHP导入Excel和导出数据为Excel文件

    有时需要将Excel表格的数据导入到mysql数据库中,我们使用PHP的一个开源项目PHP-ExcelReader可以轻松实现Excel的导入.另外将mysql数据导出为Excel与本站上篇文章中导出 ...

  2. htaccess转换httpd.ini方法及案例参考

    案例1:httpd.ini适合IIS使用,.htaccess适合Apache使用,nginx.conf适合Nginx使用 转换前:httpd.ini [ISAPI_Rewrite] # 3600 =  ...

  3. windows 安装python

    前言: Windows 中直接使用Python真的是心累 安装vs 2017(最好是最新版的, 因为python依赖于一些vs提供的包) 下载最新的python的安装程序 安装完毕之后, 不像Linu ...

  4. 性能测试学习第十一天_Analysis

    Analysis的功能:对测试运行结果进行查看,分析和比较 导入分析文件:loadrunner results文件和analysis session文件 Analysis窗口: 1.会话浏览器窗格 2 ...

  5. Unity3d开发的第一个实例

    1.untiy3d开发环境配置好以后,开始我的第一个开发实例 2.在Hirearch---create---3DObject---Cube,在场景中创建一个正方体 3.project---create ...

  6. java如何调用服务端的WSDL接口

    如何使用http://192.168.0.170:8090/kaoshi?wsdl调用服务端暴露在外面可以使用的接口 1.首先创建调用ws的web项目,就一个普通的web项目就行: 2.通过eclip ...

  7. asp.net 在IIS上配置出现的一些问题

    1.可能会遇到一下图的错无.请求的内容似乎是脚本.因而将无法由静态文件处理程序来处理---大概的原因是应用程序池选择错误了.如第二幅图如此解决即可 解决方案如下两个图所示. 我遇到了以上的问题之后能也 ...

  8. mysql通过event和存储过程实时更新简单Demo

    今天想稍微了解一下存储过程和EVENT事件,最好的方法还是直接做一个简单的demo吧 首先可以在mysql表中创建一个users表 除了设置一些username,password等必要字段以外还要设立 ...

  9. vuejs 生命周期 updated

    前段时间 公司领导提示出了一个需求就是 像微信朋友圈一样,刷列表 一直刷到 底部或者是半中央,然后点击返回或者是离开一下 页面,再辞进入朋友圈页面依然现实的还是之前滚动的位置. 我现在做的公司贷后系统 ...

  10. xaml实现无边框窗口

    <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/w ...