自动取款机源代码(CandC)(Cand(C))_第1页
自动取款机源代码(CandC)(Cand(C))_第2页
自动取款机源代码(CandC)(Cand(C))_第3页
自动取款机源代码(CandC)(Cand(C))_第4页
自动取款机源代码(CandC)(Cand(C))_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

自动取款机源代码(CandC)(Cand(C))C++and(C).Txtandhandsomemenshakehands,anddeepmentalkaboutheart,andsuccessfulmenmoreexchanges,andordinarymenlive.#include<iostream.h>#include<fstream.h>ttinclude<stdio.h>#include<time.h>ttinclude<string.h>#include<windows.h>StructAcount{Charname[20];Intcardnu;Intcode;DoubleBan;Chartime[26];StructAcountuser;Inti;Void,Welcome()ICout«***«endl;Cout<<**welcomestheuseofthenewprofitbankATM**«endl;Coutくく"*****************************************\n"<<endl;Cout<<"Please,select,your,native,lanuage,くpleaseselectuserlanguage>\n"«endl;Cout«"1.English\n2.,Chinese\n3.Exit<exitsystem>\n"<<endl;Cout<<"Enter,you,choice,<between,Ito,3>":";)Char,*_time(){Time_trawtime;StructTM*timeinfo;Time(&rawtime);Timeinfo=Localtime(&rawtime);Returnasctime(timeinfo);)Intfind(intcard){i=-l;IfstreaminCacount.dat",ios::binary|ios::nocreate);If(...In)Return0;While(...In.eof()){i++;In.read((char*)&user,sizeof(user));If(user.cardnu==card)In.close();Return1;In.close();Return0;)Int,cardnumber2()IIntn;Fstreamfile(accountnumber.Dat,ios::binary|ios::nocreate|ios::in|ios::out);If(...File)(Coutくくcannotopenthisfile"«endl;Return0;N=0;While(…N){File.read((char*)&n,sizeof(int));)Intm=0;File,seekp(-4,ios::cur);File,write((char*)&m,sizeof(int));File,close();Returnn;)Void,print2()(System("CLS");Chartime[25];Strcpy(time,time());Time[24]=,Cout«"AUTOMATICTELLERMACHINE-HENERBANKINGSYSTEM"«endl;Cout«"CARDHOLDERBILLCOPYcardholderstubs"«endl;Cout«〃+ +"<<endl;Cout«"Iterminal||<<endlNo.10203";Cout<<"+ +"<<endl;Cout«"IIauthorizedcreditcard|"«endl;Cout<<"Icard|"<<user.cardnu<<"|"«endl;Cout«"III"«endl;Cout<<"Itransactiontype|bankcardaccount|"«endl;Cout<<"Itrading|198447batches|"«endl;Cout«"Itime/date|"<<time<<"|"«endl;Cout<<+“<<endl;Cout«"CAEDHOLEDERSINATUREIII"«endl;Cout«*Icardholdersignature|<<endl;Cout«〃+ +“<<endl;Cout«"I,ACKNOWLEDGE,SATISFACTORY,RECEIPT,OF,RELATIVE,SERVICES"«endl;Cout<<"Iagreewiththeaboveterms,"<<endl;)Voidprint2(intx)!System("CLS");Chartime[25];Strcpy(time,_time());Time[24]='';Cout«"AUTOMATICTELLERMACHINE-HENERBANKINGSYSTEM"<<endl;Cout«/'CARDHOLDERBILLCOPYcardholderstubs"«endl;Cout<<“+ +"<<endl;Cout<<"Iterminal||<<endlNo.10203";Cout<<“+ +"<<endl;Cout<<"IIauthorizedcreditcard|"«endl;Cout«"Icard|"<<user.cardnu<<"|"«endl;Cout«"III"«endl;If(x>0)Cout«"Itransactiontype|cashdeposit|"«endl;Else{x=-x;Cout«"Itransactiontype|cash|"<<endl;Cout«”Itrading198447batches«endl;Cout<<"+ +〃<<endl;Cout«”Itime/date«time<<«endl;Cout<<"Itransactions<<x<<<<endl;court<<"+ +〃<<endl;courtくく“Icaedholedersinature||"<<endl;court<<"I持卡人签名II”くくendl;court<く"+ +"<<endl;court<<"iacknowledgesatisfactoryreceiptofrelativeservices"<くendl;court<く"我同意以上条款"くくendl;court<く"按任意键返回";cin.get();cin.get();saving2(void)[charch;inttem;court<く”请将现金送到指定入口:“;cin>>tor;user,ban+=tor;fstreamout("acount.dat"ios::in|ios::out|ios::binary).out.seekp(i*sizeof(user),ios::beg);out.write((char*)&user,sizeof(user);out.close();court<<"\t\t\t你已存入"くくくくendltor;sleep(3000).court<く”需要打印凭条吗?(y=是.n=否):"く<endl;cin>>ch;if(ch=='y'!丨ch=='y')print2(tor).)drawmoney2(void)(charch;inttem;court<く"请输入所取金额(必须是100的整数倍):";cin>>tor;while(as%)(court<<"sorry,请重新输入";cin>>tor;user,ban-=tor;fstreamout("acount.datios::in|ios::out|ios::binary).out.seekp(i*sizeof(user),ios::beg);out.write((char*)&user,sizeof(user);out.close();court<<”请在30秒内取走现金;"<<<<endltor;sleep(3000).court<く"需要打印凭条吗?(y=是,n=否):";cin>>ch;if(ch=='y'I1ch=='y')print2(-tor);}change2(void)inttor,j=3;court<く”请输入你的原密码”;do{cin>>tor;J-;if(as==user,code){court<く”请输入你的新密码:“;cin>>tor;user.code=tor;fstreamout("acount.dat"ios::binary|ios::inios::out);out.seekp(i*sizeof(user),ios::beg);out.write((char*)&user,sizeof(user);out.close();court<<"密码修改成功,请记下此密码"くくくくendltor;sleep(2000);court<く”按任意键返回”;cin.get();cin.get();)elseCout<<"passworderror,pleasere-enter(youhave"«j«"secondentry")";}while(J);)Void,Select2()!Int,choice,code;Cout<<"pleaseenteryourPINnumber."";Do{Cin>>code;If(user,code-code)Break;ElseCout«passworderror,pleasere-enter”;}while(2);Do(Cout<<"pleaseselectbusinessfunctions",<<endl;Cout<<"1.RMBdepositbusiness\n2.RMBwithdrawalsbusiness\n3.balanceinquiries\n4.modifypassword\n5.return\n"«endl;Cout«"pleaseselect<1to5 ;Do(Cin>>choice;Switch(choice)Case,1:,Saving2();break;Case,2:,Drawmoney2();break;Case3:{cout«”thebalanceonyourcardis:"<<user.Ban«endl;cout<<"pressanykeytoreturn";<<endl;getchar();break;}Case,4:,Change2();break;Case5:return;break;Default:cout<<"theinputisnotvalid.Pleasere-enterit:";)}while(choice>5||choice<l);}while(choice,=5);)Void,TellerMach2(){Inttem;Charch;Do{Cout«"pleaseinsertabankcard(0=cancel):Cin>>tem;If(tem-O)Break;Else[If(find(TEM)=0)(Cout<<"excuseme,thisATMdoesn(tacceptyourbankcard."!(pressFtocontinue,pressanykeytoreturntothepreviouslayer)«endl;Cin>>ch;If(CH,=’ドI|ch=='f')Break;)Else,Select2();}while(1);Void,Management2()Intchoice;Cout<<z,pleaseselectyourbusinessfunction\n\n1.bankcardaccountbusiness\n2.return\n"<<endl;Cout«”pleaseselect<1to2>.":";Do{Cin>>choice;If(choice==2)Return;Elseif(choice==l)(OFSTREAMout("acount.dat",ios;:binary|ios::app);Cout«"pleaseenteryourname.":";Cin>>;User.cardnu=cardnumber2();Cout<<"youraccountnumberis”<<user.cardnu<<endl".;Intn;Cout«"\n,pleaseenteryourpassword(mustbe6bits):Do{Cin>>n;If(n<100000)Cout<<thepasswordisnotenough.Pleasere-enterit:";If(n>999999)“Coutくく“passwordistoolong.Pleasere-enterit:";}while(n<100000||n>999999);User.code=n;User.Ban=10.0;Strcpy(user,time,_time());Out.写((char*)和用户,sizeof(用户));出来。〇;coutくく“是否打印凭条吗?(y=是,n=否):”;ch;CIN;如果(CH==Y||CH==Y)print2();coutくく“按任意键返回上一层"くくendl;getchar();打破;)其他的coutくく“输入错误!请重新输入:";}(1);国际cardnumber1()intn;fstream文件(“账号.dat”,ios::::二进制|iOSios::nocreateios::在Iios::out);如果(1文件){coutくく“无法打开文件"«endl;返回0;)n=0;而(!n)文件读取((char*)&n,sizeof(int));)整数m=0;文件。seekp(4,ios::CUR);文件编写((char*)&M,sizeof(int));文件。〇;返回N;)无效printl()(系统(“CLS”);字符时间[25];strcpy(时间,_time());时间[24]=;coutくく"自动取款机hener银行系统"くくendl;coutくく“持卡人的帐单副本持卡人存根”くくendl;cout«"+ +"<<endl;coutくく"I终端IDI10203I"«endl; +”<<endl;coutくく“I卡型I亨利银行信用卡I”くくendl;coutくく"I卡号I”くく用户。cardnuくく"|"くくendl;cout«"III"<<endl;cout«"ITRENS型I开账户I”くくendl;coutくく"I批号I198447I”くくendl;cout«"IIIn<<endl;coutくく“I数据/时间I”くく时间くく“I”くくendl;cout«“+ +”<<endl;coutくく“Icaedholeder签名I|"くくendl;coutくく“I持卡人签名Iド'くくendl;coutくく“+ +”<<endl;coutくく“我承认收到相对满意的服务”的くくendl;coutくく“我同意以上条款”くくendl;coutくく“按任何肯退出”;get()CIN;get()CIN;)无效printl(intx)系统(“CLS”);字符时间[25];strcpy(时间,_time());时间[24]:;coutくく“自动取款机hener银行系统”くくendl;coutくく“持卡人的帐单副本持卡人存根”くくendl;coutくく“++”«endl;coutくく“I终端IDI10203ドくくendl;cout«"+ +”くくendl;coutくく“I卡型I亨利银行信用卡I”くくencll;coutくく“I卡号I”くく用户。cardnu«"|"くくendl;coutくく"III"くくendl;如果(x>0)coutくく“I反式I押金I”くくendl;其他的{X=x;coutくく"I反式I以现金I”くくendl;)coutくく“I批号I198447I”くくendl;coutくく"III"くくendl;cout«"I总量I"くくx«"I"«endl; +”<<endl;cout«"Icaedholeder签名I|”<<endl;coutくく“I持卡人签名II”くくendl;cout«"+ +”«endl;coutくく“我承认收到相对满意的服务”的くくendl;coutくく“我同意以上条款”くくendl;coutくく“按任何肯退出”;get()CIN;get()CIN;}无效savingl()ch;intTEM;coutくく“请将现金预约入口:";宫颈上皮内瘤变;用户禁止+=Tem;fstream出来("count.dat”,ios::inIios::out|ios::binary).out.seekp(i*sizeof(user),ios::beg).out.write((char*)&use,sizeof(user).out.close().i"'\t\t\tyouhavedeposit”くくくくくくくくくくendl.)sleep(3);cost","doyouwanttoprint?(y/n):<<<<<endl.>».if(ch=='y'IIch=='')printl(tem).drawmoney1(void)charch;intem.ipleaseinputtheamountofmoneeyyouwant(itmustbeisthemutipleof100).>>tem.while(tempercent)ii"sorry,pleaseinputagain.>>tem.)user,banbytem.fstreamout("acount.dat,ios::in|ios::out|ios::binary).out.seekp(i*sizeof(user),ios::beg).out.write((char*)&use,sizeof(user).out.close().cost"pleasetakethecashin30seconds."<<<<<<<<<<endl.)sleep(3);cost","doyouwantaprint?(\n).>».if(ch=='y'IIch=='')printl(tem).)voidchangel()!intj=3;temiinjoutoriginalpassword”.do{->>tem.if(a==user.code.)ipleaseinputyounewpassword:.->>tem.user,code=tem.fstreamout("acount.dat,ios::in|ios::out|ios::binary).out.seekp(i*sizeof(user),ios::beg).out.write((char*)&use,sizeof(user).out.close().irevisethepasswordsuccessfully,makenoteofthispassword,please""tim"endl.sleep(2000).d=0.“pressanykey"cost"toexit.cin.get().cm.getelseipassworderror,inputagain(youstillhaveiopportunity)selectl(void)Iinchoice,code;i""pleaseinputyourpassword.do{->>codeofconduct;if(user,code==)break;elseipassworderror,inputagain.“⑵.do("cost"andthebusinessfunction("<<endl."cost",bankdepositofrmb\n2.takingthermb\n3.inquirebalance.4.revisethepassword?5. \n""endl.coutくく“请选择く5>:1间”;做{选择;开关(选择)!案例1:savingl();打破;案例2:drawmoney1();打破;案例3:{coutくく’’你的余额账户是:“くく用户。禁止くくendl;coutくく“按任意键退出“くくendl;getchar();break;}案例4:changel();打破;案例5:返回;中断;默认值:coutくく“输入错误,请重新输入:)}而(选择>5丨|选择く1);)(选择)!=5);)无效tellermachl()Ich;做{coutくく“请插入银行卡(0=取消):”;>>user,cardnuCIN;如果(用户。cardnu==0)打破;如果(发现(用户。cardnu)==0)coutくく“对不起,您的信用卡被接受!(按下F键继续,按回车键退出)“くくendl;CIN;如果(CH)!=F||CH==F)打破;)其他selectl();)}(1);)无效management1(){int的选择;coutくく“请选择您的业务功能、n\n!〇银行卡账户业务、n2〇退出\n"<<endl;coutくく"请选择く1到2>:”;做{选择;如果(选择=2)返回;否则如果(选择=1)I流出来("count.dat”,ios:::;二进制|iOSApp);coutくく"请输入你的名字:";CIN>>user,name;cardnu=cardnumberl()用户;coutくく"你的帐号是"くく用户cardnu«endl;intn;coutくく"请输入你的密码(长度必须为6);”;CIN;如果(n<100000)coutくく“密码长度太短,请再次改变:“;如果(n>999999)coutくく“密码长度太大,请再次改变:“;)而(n<100000IIn>999999);用户,代码

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论