您好,欢迎访问三七文档
当前位置:首页 > 金融/证券 > 金融资料 > C++银行账户管理系统源代码最终版本
#includeiostream#includecstdio#includecstdlibusingnamespacestd;#includestring#includefstream#includeiomanipclassUserinformation//定义基类Userinformation,用来储存用户信息{public:doublelixi;doublesui;stringuserNum;stringuserName;stringuserID;stringpassword;stringstatus;doublemoney;intday,month,year;intnumber;intr2;intcountday;public:voidsetlixi(doublea){lixi=a;cout成功设置日利率!endl;cout利率为:lixi%endl;}voidsetsui(doublea){sui=a;cout成功设置税率!endl;cout利率为:sui%endl;}voidchange_money_li(intcday){money=money+money*(lixi/(double)100)*(double)countday*(1-(sui/(double)100));}voidchange_money(doublemon){money+=mon;}Userinformation(){}Userinformation(stringa,stringb,stringc,stringd,stringe,intg,inty,intm,intda)//声明基类Userinformation中有7个对象{userNum=a;userName=b;userID=c;password=d;status=e;money=g;day=da;month=m;year=y;}voidset_time(intda,intm,inty)//输入开户时间{day=da;month=m;year=y;}voidset_password(stringa){password=a;}stringget_userNum()//获取银行卡号{returnuserNum;}stringget_password()//获取密码{returnpassword;}stringget_status()//获取用户状态{returnstatus;}doubleget_money()//获取用户金额{returnmoney;}voiddisplay()//输出用户基本信息{cout以下是用户信息:endl;cout********************\n;cout银行卡号:userNumendl;cout用户姓名:userNameendl;cout用户身份证号:userIDendl;cout用户密码:passwordendl;cout开户时间:year年month月day日endl;cout用户密码:passwordendl;cout用户状态:statusendl;cout用户金额:setiosflags(ios::fixed)setprecision(3)moneyendl;cout********************\n;coutendl;}intget_number(){returnnumber;}voidWait(){longj=0;for(doublei=1000000;i0;){i=i-0.002;j++;j--;}}voidwritelixi(){ofstreamstuf1(E:\\高层管理数据1.txt,ios::out);stuf1setiosflags(ios::fixed)setprecision(3)lixi;stuf1.close();cout保存成功!endl;coutendl;}voidwritesui(){ofstreamstuf2(E:\\高层管理数据2.txt,ios::out);stuf2setiosflags(ios::fixed)setprecision(3)sui;stuf2.close();cout保存成功!endl;coutendl;}};classmanager:publicUserinformation//派生类manager对用户信息进行管理{private:UserinformationB[1000];intsum;public:stringmanagercode;manager(){sum=0;number=0;}voidsetmanagercode(stringa){managercode=a;cout密码设置成功!endl;}voidshowuserNumber(){cout您的银行卡账号为:setw(6)setfill('#')sum+numberendl;}voidOpenAccount(Userinformationa)//开户{B[number+sum]=a;sum++;cout开户成功!endl;coutendl;}voidCloseAccount(Userinformationa)//销户{stringcode;charc;intflag=0;intcount=0;if(sum==0){cout不存在该用户,销户失败!endl;}else{for(inti=0;isum;i++){if(B[i].get_userNum()==a.get_userNum()){cout找到该用户endl;cout请输入密码:endl;cincode;while(B[i].get_password()!=code&&count=3){cout密码错误,请重新输入:(您只有三次机会);cincode;count++;}if(B[i].get_password()==code){B[i].display();count++;cout确认-Y/取消-N:;cinc;if(c=='Y'||c=='y'){for(intj=i;jsum-1;j++){B[j]=B[j+1];}flag=1;sum--;cout销户成功!endl;break;}}if(count3)break;}}if(!flag){cout该用户不存在!endl;}}}voidHookAccount(Userinformationa)//用户挂失{charc;intflag=0;for(inti=0;isum+number;i++){if(B[i].get_userNum()==a.get_userNum()){if(B[i].get_status()==HOOK){cout该用户已挂失!endl;coutendl;break;}else{coutendl;B[i].display();cout确认-Y/取消-N:;cinc;if(c=='Y'||c=='y'){flag=1;B[i].status=HOOK;cout挂失成功!endl;coutendl;}}}}if(flag==0){cout该用户不存在!endl;coutendl;}}voidUnhookAccount(Userinformationa){charc;inti;intflag=0;for(i=0;isum+number;i++){if(B[i].get_userNum()==a.get_userNum()){if(B[i].get_status()==UNHOOK){cout该用户无进行过挂失处理!endl;coutendl;break;}else{B[i].display();cout确认-Y/取消-N:;cinc;if(c=='Y'){flag=1;B[i].status=UNHOOK;cout取消挂失成功!endl;coutendl;}}}}if(flag==0){cout错误!该用户不存在!endl;coutendl;}}voidSaving(Userinformationa,doublemon,intr1)//存款{inti;for(i=0;isum+number;i++){if(B[i].get_userNum()==a.userNum){if(B[i].get_status()==HOOK){cout对不起,用户已被冻结,无法修改!endl;coutendl;}else{r2=f1(B[i].year,B[i].month,B[i].day);B[i].countday=r1-r2;B[i].change_money_li(B[i].countday);B[i].change_money(mon);cout成功存款:monendl;coutendl;}}}if(i==sum+number+1){cout错误该用户不存在!endl;coutendl;}}voidDrawing(Userinformationa,doublemon,intr1)//取款{inti;charc;for(i=0;isum+number;i++){if(B[i].get_userNum()==a.userNum){if(B[i].get_status()==HOOK){cout对不起,用户已被冻结,无法修改!endl;coutendl;}else{r2=f1(B[i].year,B[i].month,B[i].day);B[i].countday=r1-r2;B[i].change_money_li(B[i].countday);if(monB[i].money){cout您的余额不足!无法进行取款!endl;coutendl;}else{B[i].change_money(-mon);cout成功取款:monendl;cout打印拼条?y/nendl;cinc;if(c=='y'||c=='Y'){cout凭条打印中,请稍后!endl;B[i].Wait();cout余额:setiosflags(ios::fixed)setprecision(3)B[i].get_money()endl;coutendl;}}}}}if(i==sum+number+1){cout错误该用户不存在!endl;coutendl;}}voidTransfering(Userinformationa,intr1)//转账{stringusernum1;intj;inti;intmon;charc;for(i=0;isum+number;i++){if(B[i].get_userNum()==a.userNum){if(B[i].get_status()==HOOK){cout对不起,用户已被冻结,无法修改!endl;coutendl;}else{r2=f1(B[i].year,B[i].month,B[i].day);B[i].countday=r1-r2;B[i].change_money_li(B[i].countday);cout请输入要转账的银行卡号:;cinusernum1;for(j=0;jsum+number;j++){if(B[j].get_userNum()==usernum1){cout请输入要转账的金额:endl;cinmon;if(
本文标题:C++银行账户管理系统源代码最终版本
链接地址:https://www.777doc.com/doc-7216006 .html