c++银行管理系统实验报告Word文档下载推荐.docx
《c++银行管理系统实验报告Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《c++银行管理系统实验报告Word文档下载推荐.docx(28页珍藏版)》请在冰点文库上搜索。
4、消户,管理员输入用户帐号,密码,显示用户信息,确认后进行操作。
(二)用户模式
1、存款,用户输入帐号,密码,存款金额进行操作。
2、取款,同上。
3、查询,输入密码。
4、转账,输入本人密码,对方账号,转账金额进行此操作。
5、更改密码,输入原密码,再输入新密码,然后确认新密码。
三、课程设计工作计划
1、确定题目,成立设计小组,做用户需求分析
2、查阅资料,进行问题分析,制定方案,确定成员分工
3、根据方案编写程序并进行调试
4、撰写设计说明书,完成设计
5、提交设计内容,答辩
四、相关教材及参考书目
1、谭浩强.C++语言基础课程.清华大学出版社,2009
2、郑莉.C++语言程序设计案例教程.清华大学出版社,2005
3、王瑞等.VisualC++数据库系统开发完全手册.人民邮电出版社,2006
4、郑莉.C++语言程序设计习题与实验指导.清华大学出版社,2007
5、张基温.C++程序设计基础例题与习题.高等教育出版社,2008
6、于永彦.C++程序设计基础案例教程.北京大学出版社,2009
7、
五、系统模块
本系统包括管理员模式其中包括:
开户、挂失、取消挂失、消户功能;
用户模式其中包括:
存款、取款、查询、转账、更改密码功能,如图1所示
用户模式
管理员模式
银行账户管理系统
更改密码
转账
查询
取款
存款
消户
个人信息
登入
开户
图1银行账户管理系统模块
1、管理员模式:
此模式用于银行管理员为用户开户使用户获取账号,凭用户获取的账号银行管理员可为用户提供挂失,解除挂失销户的服务。
2、用户模式:
此模式用于用户在银行中存款,取款,查询自己在银行账户中的余额,还提供转账功能,为用户带来便利,修改密码使用户可以随时更改自己账户的密码,使得账户安全。
6、程序设计分析
李世生负责的模块:
#include<
iostream>
#include<
string>
#include<
stdlib.h>
fstream>
conio.h>
intcode();
//登录密码usingnamespacestd;
classconsumer;
classYH
{
public:
YH();
voidset_account();
//银行开户
voiddel_account();
voidtransfer(int);
//转账voidenter_account();
voidaddmoney(int,float);
voidexitYH();
//退出系统
voidfunctionshow();
voidsave();
voidload();
//功能界面
protected:
consumer*account[20];
static intacnum;
//账户数
};
//登录密码intcode()
inti=0,j=0;
intc;
charname[15],cod[15];
cout<
<
"
\n\n"
;
while(j<
3)
cout<
\t\t管理员:
cin.getline(name,sizeof(name));
//用cin不包括空格符;
endl<
\t\t输入密码:
j++;
c=getch();
while(c!
='
\r'
)//回车
if(i>
=0)
if(c=='
\b'
)
\b\b"
i=i-1;
}
else
*"
cod[i]=c;
c=getch();
if(c!
i=i+1;
cod[i]='
\0'
\t\t"
if((strcmp(name,"
6539"
)==0)&
&
(strcmp(cod,"
li"
)==0)
||(strcmp(name,"
2"
222"
)==0))
登陆成功!
j=4;
break;
***"
)!
=0)||(strcmp(name,"
***"
=0))
登陆失败!
密码错误!
!
elsecout<
管理员不存在!
returnj;
intYH:
:
acnum=0;
YH:
YH()
for(inti=0;
i<
20;
i++)
account[i]=NULL;
classconsumer:
publicYH
friendclassYH;
consumer(intid,stringName,stringPassWord,floatm)
ID=id;
name=Name;
money=m;
passwd=PassWord;
consumer()
{ID=0;
name='
0'
money=0;
passwd='
intget_id(){returnID;
}voidsavemoney();
//存钱
stringget_passwd()
{returnpasswd;
//取得密码
voiddisplay();
voidfetchmoney();
//取钱voidchange_passwd();
voidadd_money(float);
voiddec_money(float);
floatget_money();
//卡卡转帐private:
intID;
//开户帐号
stringpasswd;
//用户密码stringname;
//用户姓名floatmoney;
voidYH:
save()
{ofstreamofile("
bankdat.txt"
ios:
out);
ofstreamoutfile("
intn=0;
outfile<
acnum<
"
for(;
n<
acnum;
n++)
{outfile<
account[n]->
ID<
outfile<
money<
"
name<
passwd<
outfile.close();
//page_break
load()
{ifstreaminfile("
in);
if(!
infile)
{cerr<
读取错误,无资料中!
endl;
return;
intn=0;
intid,m;
stringnam,passw;
infile>
>
{infile>
id;
m;
nam;
passw;
account[n]->
passwd;
consumer*acc=newconsumer(id,nam,passw,m);
account[n]=acc;
infile.close();
读取资料正常!
周刊负责的模块:
transfer(intx)
{intid;
请输入帐号:
cin>
intflag=1;
inti=0;
while((i<
acnum)&
(flag))
if(id==account[i]->
get_id())flag=0;
else i++;
if(flag)
帐号不存在!
return;
floatb;
请输入你要转帐的金额:
b;
while(b<
=0)
请输入正确的数字!
$>
cin>
if(account[x]->
get_money()<
b)cout<
对不起,金额不够!
!
else{account[x]->
dec_money(b);
account[i]->
add_money(b);
转帐成功!
voidconsumer:
add_money(floatx)
{money=x+money;
dec_money(floatx)
money=money-x;
addmoney(intx,floaty)
{account[x]->
money=account[x]->
money-y;
floatconsumer:
get_money()
returnmoney;
intmain()
system("
color70"
);
inti=0;
\t【】\t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
〓〓〓 【】"
for(i=0;
3;
\t【】\t◎\t\t\t\t\t\t◎ 【】"
\t【】\t◎◎◎Oo【 欢迎进入银行账户管理系统
】oO◎◎◎ 【】"
\t【】\t◎\t\t\t\t\t\t◎ 【】"
\t【】\t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
〓〓〓〓〓 【】"
\t【】\t\t\t\t\t\t\t 【】"
\t【】┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
┅┅┅┅┅【】"
if(code()!
=4)
\t\t输入次数已到!
\n"
return0;
getch();
YHyh;
yh.functionshow();
return0;
functionshow()
intn;
do
{system("
cls"
load();
\t\t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
〓〓"
\t\t\t\t1) 用户开户"
\t\t\t\t2) 账户登陆
\t\t\t\t3) 帐户注销"
\t\t\t\t4) 退出系统
〓〓\n"
请你输入相应的操作序号进行操作:
n;
while(n<
1||n>
4)
请输入正确的操作序号!
$>
switch(n)
case1:
set_account();
case2:
enter_account();
case3:
del_account();
case4:
exitYH();
cin.get();
while(true);
enter_account()
intid;
while((i<
请输入密码:
stringpassw;
if(passw!
=account[i]->
get_passwd())return;
account[i]->
display();
cin.get();
intn;
do{system("
\t\t\t\t1)查看信息"
\t\t\t\t2)取款
\t\t\t\t3)存款"
endl
\t\t\t\t4)修改密码"
\t\t\t\t5)转账
\t\t\t\t6)返回"
请选择你要进行的操作:
while(n<
6)
谢谢"
{case1:
case2:
fetchmoney();
save();
savemoney();
case4:
change_passwd();
case5:
transfer(i);
case6:
while
(1);
set_account()
stringnam;
floatm;
请输入开户号:
请输入开户人姓名:
请输入开户密码:
请输入存入金额:
while(m<
account[acnum]=acc;
开户成功!
acnum++;
save();
return;
}
胡楠松负责的模块:
del_account()
请输入你要注销的帐户号:
if(id==account[i]->
get_id())
flag=0;
{i++;
for(intj=i;
j<
j++)
account[j]=account[j+1];
account[acnum-1]=NULL;
acnum--;
注销成功!
change_passwd()
stringpwd,repwd;
请输入新密码:
pwd;
请再输入一次新密码:
repwd;
if(pwd!
=repwd)
你输入的两次密码不一样,请重新输入!
passwd=pwd;
密码修改成功,请牢记!
fetchmoney()
floatm;
charch;
do{
你要取多少钱:
endl;
//page_break
if(money<
m)
对不起,你的余额不足!
}else
{money=money-m;
操作成功,请收好钱!
是否要继续该项操作:
(Y/N)"
ch;
while(ch!
='
n'
ch!
N'
Y'
y'
}while(ch=='
||ch=='
}voidconsumer:
savemoney()
floatc;
do
你要存多少钱:
c;
while(c<
money=money+c;
操作已成功!
=