C++银行管理系统方案文档格式.docx
《C++银行管理系统方案文档格式.docx》由会员分享,可在线阅读,更多相关《C++银行管理系统方案文档格式.docx(19页珍藏版)》请在冰点文库上搜索。
![C++银行管理系统方案文档格式.docx](https://file1.bingdoc.com/fileroot1/2023-5/9/f8b1a490-fa44-44e8-8fe8-294af56c34d3/f8b1a490-fa44-44e8-8fe8-294af56c34d31.gif)
采用文件的重新写入来实现存取款。
四、程序的一些设计的技巧以及注意情况:
为了使程序模块化,我们要采用多文件的开发。
也就是说,为了使程序简练,把一些需要重复利用的代码写到.h的文件里面。
五、代码实现:
#include"
stdafx.h"
#include<
iostream>
map>
stack>
sstream>
stdio.h>
windows.h>
stdlib.h>
fstream>
vector>
algorithm>
Welcome_UI.h"
Register_UI.h"
Sign_UI.h"
Secondary_UI.h"
usingnamespacestd;
classBank_Management
{
private:
stringnew_name;
stringpre_name;
intpassword;
doubleextra_money;
public:
voidcreat_user(stringname,intpass);
intsign_user(stringname,intpass);
doubleaccount_balance();
voidwithdraw_money();
voidquery_account();
voidchange_password();
};
Bank_Managementoperation[1024];
ofstreamRec_history("
Historicalrecords.txt"
ios:
:
in|ios:
out|ios:
app);
intmain_ui()
printf("
\n\n"
);
\t\t%cWelcometouseBankManagementSystem!
%c\n"
3,3);
\t\t\t%cCopyrightbySunYu_peng!
4,4);
\t\t\t%c++++++++++++++++%c\n"
\t\t\t+Hereisthesystemmenu!
+\n"
\t\t\t++\n"
\t\t\t+1.Depositmoney+\n"
\t\t\t+2.Withdrawmoney+\n"
\t\t\t+3.Querybalance+\n"
\t\t\t+4.Historicalrecords+\n"
\t\t\t+5.Changepassword+\n"
\t\t\t+6.Saveandexit+\n"
\t\tPleaseentertheorderthatyouwant:
"
intorder;
cin>
>
order;
if(order==1)
{
system("
cls"
operation[0].account_balance();
}
elseif(order==2)
operation[0].withdraw_money();
elseif(order==3)
operation[0].query_account();
elseif(order==4)
printf("
\n\n\n\n"
Secondary_ui();
\tAlldateshavebeensavedinthefile(Historicalrecords.txt)"
Sleep(5000);
elseif(order==5)
operation[0].change_password();
elseif(order==6)
Rec_history<
<
Theuserdecidedtoexitthesystem!
\n"
;
return0;
else
Theuserhasdoneawrongoperation!
Thesystemexited!
}
voidBank_Management:
creat_user(stringname,intpass)
new_name=name;
password=pass;
intBank_Management:
sign_user(stringname,intpass)
ifstreamOpenFile("
Usernameandpassword.txt"
stringget_name;
intget_pass;
stack<
string>
sign;
stringstreamn;
stringpass_str;
n<
pass;
n>
pass_str;
while(OpenFile>
get_name>
get_pass)
stringstreamtemp;
stringtemp_str;
temp<
get_pass;
temp>
temp_str;
stringall_str=get_name+'
'
+temp_str;
sign.push(all_str);
while(sign.size()!
=0)
if(name+'
+pass_str==sign.top())
{
pre_name=name;
Rec_history<
Theuser:
<
name<
haslandedintheSystem"
."
"
returntrue;
}
else
sign.pop();
OpenFile.close();
doubleBank_Management:
account_balance()
Secondary_ui();
\t\tPleaseenterthemoneythatyouwantotdeposit:
double_money;
_money;
ifstreamDeposit_money("
Accountbalance.txt"
map<
string,double>
Deposit_Money;
:
iteratorit;
stringtemp;
while(Deposit_money>
temp>
extra_money)
if(temp==pre_name)
extra_money=extra_money+_money;
temp<
hasdeposited"
_money<
Yuan\n"
Deposit_Money.insert(pair<
(temp,extra_money));
Deposit_money.close();
ofstreamDepositMoney("
for(it=Deposit_Money.begin();
it!
=Deposit_Money.end();
it++)
DepositMoney<
it->
first<
\t"
second<
DepositMoney.close();
Sleep(1000);
system("
return0;
withdraw_money()
\t\tPleaseenterthemoneythatyouwanttowithdraw:
ifstreamWithdraw_money("
Withdraw_Money;
while(Withdraw_money>
extra_money=extra_money-_money;
Rec_history<
User:
haswithdrawed"
Withdraw_Money.insert(pair<
Withdraw_money.close();
ofstreamWithdrawMoney("
for(it=Withdraw_Money.begin();
=Withdraw_Money.end();
WithdrawMoney<
WithdrawMoney.close();
query_account()
ifstreamRead_only("
doubleextra;
cout<
\t\t\t\t"
Name"
Account\n"
while(Read_only>
extra)
cout<
extra<
endl;
Read_only.close();
Rec_history<
hasQueriedher/hisaccout!
Sleep(5000);
change_password()
intpass;
string,int>
change_password;
\t\tPleaseenterthenewpasswordyouwant:
doublenew_pass;
new_pass;
pass)
pass=new_pass;
change_password.insert(pair<
(temp,pass));
ofstreamres_pass("
for(it=change_password.begin();
=change_password.end();
res_pass<
Theuser"
pre_name<
haschangedhis/herpassword!
intmain()
stringname;
intcreat_num;
Softwarebegintoload!
while(true)
welcome_ui();
intorder;
cin>
if(order==1)
printf("
\t\tPleaseentertheprevioususer'
sname:
cin>
name;
\t\tPleaseenterprevioususer'
spassword:
password;
if(operation[0].sign_user(name,password)==1)
{
system("
main_ui();
}
else
printf("
\tSorry,youhavedoneawrongoperation!
Pleaserestartthesystemagain!
\a\n"
Rec_history<
Theuserwhosenameis"
hasfailedtoenterthesystem.\n"
Sleep(1000);
elseif(order==2)
system("
register_ui();
ofstreamCre_user;
Cre_user.open("
ofstreamIni_account;
Ini_account.open("
\t\tPleaseentertheuser'
squantityyouwant:
creat_num;
for(inti=0;
i<
creat_num;
i++)
\t\tPleaseenterthenew%d-user'
i+1);
cin>
\t\tPleaseenterthe%d-user'
Cre_user<
password<
Ini_account<
0<
Thesystemhascreatedauserwhosenameis"
Thesystemhasinitialized"
'
s"
account\n"
Cre_user.close();
Ini_account.close();
\tWehavesavedalloperations!
Sleep(1000);
elseif(order==3)
return0;