Bank Simulation Program银行管理系统C++ :)
设计并实现简单的银行存取款系统,系统主界面包括登录和注册两个选项,选择登录,提示用户输入银行帐号和密码,验证通过后进入主界面,主界面包括:存款、取款、查询余额、历史记录、修改密码等功能。注册功能让用户输入账号和密码,在注册时要验证账号是否已经存在。所有数据能够保存在文件中,退出系统后再次运行系统,之前注册的用户和存款信息都存在。
#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++ :)的更多相关文章
- python 银行管理系统
这是一个使用python连接mysql的例子 涉及到类的使用 import pymysql import function as f def mysql(): db=pymysql.connect(h ...
- 银行管理系统[C++]
//项目:银行管理系统 //系统实现的主要有管理,取款机管理,用户查询等功能: //*管理模块:存款.取款.开户.销户.修改信息.办卡.挂失卡; //*用户查询模块; //*取款机信息管理模块:管理员 ...
- c++ 银行管理系统及报告
1.题目描写叙述: 本代码为银行管理系统,总体分为管理员模式和普通用户模式: (1)在管理员模式中能完毕 ①用户信息录入 ②改动管理员password ③改动指定账户信息 ④信息管理业务 (2)在普通 ...
- java实现银行管理系统
Bank类 package First; import java.util.TreeSet; //银行类public class Bank { private String Bankna ...
- python连接mysql数据库实例demo(银行管理系统数据库版)
主函数: import adminView import os import pickle from bankFunction import BankFunction import time def ...
- Dark Mobile Bank之移动银行应用仿冒攻击威胁分析报告
一.背景 据“第十五次全国信息网络安全状况暨计算机和移动终端病毒疫情调查”调查结果显示,2015年移动终端的病毒感染比例为50.46%,相对于2014年增长了18.96%,移动终端病毒感染率涨幅较大, ...
- 我的Java语言学习日志1_"简单的银行管理系统实现"
设计步骤:注意:本篇代码,直接建两个类( Bank_Account.BankManage)在BankManage往里面填方法就行.是为了让和我一样自学朋友可以更快的接受.但是代码优化的空间还是很大的( ...
- JavaSwing开发简单的银行管理系统 附源码
开发环境: Windows操作系统开发工具: MyEclipse/Eclipse+Jdk+mysql数据库 运行效果图:
- 基于Java的简单银行管理系统(MVC设计模式)
项目导航 功能展示 项目描述 项目结构 `data` `service` `utils` `view ` 欠缺与总结 源码下载 功能展示 本系统基于命令台窗口,暂未与图形页面结合.话不多说,先上效果图 ...
随机推荐
- nodejs加密解密
nodejs是通集成在内核中的crypto模块来完成加密解密. 常用加密解密模块化代码: /** * Created by linli on 2015/8/25. */ var crypto = re ...
- Vue小贴士
1.去掉空格影响,删除掉此段代码 2.想要同时运行两个Vue项目,修改端口号,黄色框内的内容自己随意改个端口号就行,比如:8082 3.批处理 在项目的根目录中添加a.bat文件,这样就可以在运行的 ...
- hibernate丢失更新
如果多个线程操作基于同一个查询结构对表中的记录进行修改,那么后修改的记录将会覆盖前面修改的记录,前面的修改就丢失掉了,这就叫做更新丢失.Serializable可以防止更新丢失问题的发生.其他的三个隔 ...
- java反射-使用反射获取类的所有信息
在OOP(面向对象)语言中,最重要的一个概念就是:万事万物皆对象. 在java中,类也是一个对象,是java.lang.Class的实例对象,官网称该对象为类的类类型. Class 类的实例表示正在运 ...
- Docker的安全问题以及一些预防方案
http://blog.csdn.net/Ruidu_Doer/article/details/53401523
- Don't let anyone tell you different.
Don't let anyone tell you different.不要让任何人否定你的与众不同.
- 【MFC】可以换行的编辑框
在mfc中编辑框允许输入多行时,换行符被表示为<归位><换行>即“\r\n”,用ascii码表示为13 10 如果为编辑框中想要输入换行,就请将编辑框的属性: Auto HSc ...
- 更新浏览器,导致编写脚本报错Message: Unable to find a matching set of capabilities
卸载更新浏览器后,所编写的脚本无法运行,报如下的错误:selenium.common.exceptions.WebDriverException: Message: Unable to find a ...
- 再回首win98
因为一个软件只能运行在win98上,所以上个win98虚拟机. 下载的是经典的Win98.SE.iso 307M. 真是小巧呀,感慨现在的win8.1的3.69G,真是没法比. 原来是没有用过老古董的 ...
- LeetCode Search Insert Position (二分查找)
题意: 给一个升序的数组,如果target在里面存在了,返回其下标,若不存在,返回其插入后的下标. 思路: 来一个简单的二分查找就行了,注意边界. class Solution { public: i ...