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 ` 欠缺与总结 源码下载 功能展示 本系统基于命令台窗口,暂未与图形页面结合.话不多说,先上效果图 ...
随机推荐
- nginx开启HSTS让浏览器强制跳转HTTPS访问
在上一篇文章中我们已经实现了本地node服务使用https访问了,看上一篇文章 效果可以看如下: 但是如果我们现在使用http来访问的话,访问不了.如下图所示: 因此我现在首先要做的是使用nginx配 ...
- 图片单独上传 (word)
Word.ApplicationClass wordApp=new ApplicationClass(); object file=path; object nullobj=System.Reflec ...
- Ubuntu下eclipse无法识别手机驱动(以小米2S为例子)
google官方开发向导里对Android手机已经设置了允许安装非market程序,并且处于usb调试模式,但是仍然在usb连接电脑后无法被识别的问题作了解释. 在Ubuntu Linux环境下需要添 ...
- jQuery动态添加元素,并提交json格式数据到后台
参考:https://www.cnblogs.com/shj-com/p/7878727.html 下载 下载该插件的地址是:http://www.bootcdn.cn/jquery.serializ ...
- java如何导入Excel文件
Java使用POI导入Excel文件,操作起来比较简单,支持xlsx格式. 下载POI资源包 从官网https://poi.apache.org/下载POI,笔者选择的是版本是3.17,下载后文件名是 ...
- JS常用公共方法封装
_ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||/ ...
- centos yum 安装mysql5.7 以及 默认root密码查看
1. 首先更新rpm 从MySQL Yum仓库下载最新的rpm文件:http://dev.mysql.com/downloads/repo/yum/ (需要Oracle帐号以及填写一些使用信息,才能 ...
- agc016B - Colorful Hats(智商题)
题意 题目链接 有$n$个人,每个人有一种颜色,第$i$个人说除了我之外有$a_i$种不同的颜色,问是否存在一组合法解 Sol 700分的题就这么神仙了么..好难啊... 先说结论吧 设$mx, mn ...
- Angular CLI的简单使用(2)
刚才创建了myApp这个项目,看一下这个项目的文件结构. 项目文件概览 Angular CLI项目是做快速试验和开发企业解决方案的基础. 你首先要看的文件是README.md. 它提供了一些如何 ...
- 在wpf或winform关闭子窗口或对子窗口进行某个操作后刷新父窗口
父窗口: ///<summary> ///弹出窗口 ///</summary> ///<param name="sender"></pa ...