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 ` 欠缺与总结 源码下载 功能展示 本系统基于命令台窗口,暂未与图形页面结合.话不多说,先上效果图 ...
随机推荐
- MySQL复制机制原理
背景介绍 复制,就是对数据的完整拷贝,说到为什么要复制,首先能想到的是怕数据意外丢失,使得用户蒙受损失. 当完成了数据复制之后,会发现它的优势不止这一点,假如一台机器宕机了,可以启用备份在另一台机器的 ...
- Properties IO持久化
Properties IO持久化 Properties类表示一组持久的属性. Properties可以保存到流中或从流中加载. 属性列表中的每个键及其对应的值都是一个字符串. 方法: String g ...
- X64下IIS调用32位的dll
WebAPI项目中遇到了需要调用32位C++的dll的情况,调试的时候能正常调用,但是发布了之后部署在IIS中出现了BadFormatImage异常, 解决方法是在IIS中相应应用程序池=>高级 ...
- Josn转换
也是搬的,大家勿喷,贴出来只为了自己记忆查找 需要引用 System.Web.Extensions.dll 这个类库 命名空间: System.Web.Script.Serialization 数据结 ...
- ubuntu下apk的反编译
今天调试一个程序的时候,因为需要上传数据到服务器,但是程序太过久远了,服务器上传的地址就忘记了,但是源码又不在我这里,因为要的急所以就被逼无奈的情况下想到了反编译,我用的是Linux Mint 14. ...
- Struts2笔记3--OGNL
一.OGNL入门 1.简介 OGNL的全称是对象图导航语言(Object-Graph Navigation Language),它是一种功能强大的开源表达式语言,使用这种表达式语言,可以通过某 ...
- WPF创建SignalR服务端(转)
在网上看到了一个帖子,比较详细,博主写的很好. 地址:http://blog.csdn.net/lordwish/article/details/51786200
- nginx对不存在的文件进行404处理
location / { try_files $uri $uri/ /?$args 404; } location / { try_files $uri $uri/ /index.html 404; ...
- NopCommerce 3.80框架研究(二) MVC 表示层与数据验证
表示层框架结构 /Views/Shared/_Root.Head.cshtml /Views/Shared/_Root.cshtml /Views/Shared/_ColumnsOne.cshtml ...
- linux 命令——22 find (转)
find一些常用参数的一些常用实例和一些具体用法和注意事项. 1.使用name选项: 文 件名选项是find命令最常用的选项,要么单独使用该选项,要么和其他选项一起使用. 可以使用某种文件名模式来匹 ...