自动取款机源代码_第1页
自动取款机源代码_第2页
自动取款机源代码_第3页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

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

文档简介

1、#include iostream.h #include fstream 。 h> include <stdio 。 h# in elude <time。h> include string.h #include windows.h struct Aco untchar name20 ;int cardnu;int code ; double Ban;char time26 ;struct Acount user int i;void Welcome ()cout <"*"< endl;cout <"*? Oo e 1 o

2、?D?d ? o ?DDATM?i* "<<e ndl;cout "* * * * * * * * * * * *n" <endl ;cout<<"Pleaseselect your native lanuage <?O ?§O ?>n"< endl;cout<< ”1. Englishn 2 。?D?n 3. Exit < i ?3?卩13 > n"< endl ;cout ” Enter you choice between 1to 3: &q

3、uot; ;char *_time( )time_t rawtime; struct tm * timeinfo;&rawtime )time ( &rawtime ) timeinfo = localtimereturn asctime (timeinfo)int find(int card)i=-1;ifstream in” acount.dat", ios:binary | ios : no create);if( ! in )return 0while(!in.eof i+;in.read( ifuser in.close return 0;)char * )

4、&user,sizeofcardnu=card )user );in 。 closereturn 1);int cardnumber2 int nfstream in|ios:out);if(file!filecout<<"2?return 0;"?o?.dat",ios: binary|ios:nocreateios:u,o ?a' ?t ”<endl ;n=0;whilen)file.readint m=0;file.seekpfilefilereturnvoid print2system ( char timestrcpyt

5、ime24(char ) &n ,sizeof(int-4,ios write(char 。close( )n;"cls ”) ;25;(time ,=' ';);: :cur ) ;) m,sizeof(int);_time () );”<endl ;endl;cout<<"bi ?o ao ?e ? i ?"<e ndl;cout <" AUTOMATIC TELLER MACHINE HENER BANKING SYSTEM"< endl; cout< "CARD

6、HOLDER BILL COPY 3? e ?' ? u "<endl;cout <” +- - - - - +”<<endl ;cout<" |?u o?|10203|” <<endl ;cout<<"+- - - - - +”<endl;cout<" |?'±e| D? o ?|"endl ;cout<"|?'o?|<user。cardnu< ”|”<endl ;cout<"|”<end

7、l;cout<”|?oXaa Di|o ?DD?a? §|IIendl;cout”|?oX ? u o?| 198447|”<<endl ;cout<"|e±?/e?u|"<time< " |"<<endl;cout<"+ - - - - -+"<<endl;cout<” | CAEDHOLEDER SINATUREendl;cout<<"| 3?'-e ?cout<<"+- -+”endl

8、;cout” I ACKNOWLEDGESATISFACTORY RECEIPT OF RELATIVE SERVICES”void print2(int x)system (”cls ”); char time25 ; strcpy(time,_time();time24='';AUTOMATIC TELLER MACHINE HENER BANKING SYSTEM"<<endlCARDHOLDER BILL COPY 3? e ?' ? u "<endl;?u o?|10203cout<"cout "

9、 cout<"+- -+"< endl cout"endl ;cout<"+ - - - - - - - -+"<<endl;cout<<"|?土 e|D? 0 ?'|"endl;cout< " |? o?|” <<user。cardnu"|”endl;cout<< ”|"<<endl;if (x0)cout<" |?oXdd Di |?e' ?<endl;else x= -

10、x;cout”|? oXdd Di?e e?|”endl ;cout<”|?ox?uo?|198447 |II endl;cout"+- - - - - - - - - - - +”<endl ;cout< "|e± ?/ e ?u|" time< ” |" <endl ;cout <” |?ox ?e?|” x <"|”<endl;cout<"+- - - - - - - - - - - - - - -+"endl ;cout<<" |

11、CAEDHOLEDER SINATURE<endl ;|"<<endl;cout< "|3?"e ?cout<<"+-+"<endl;cout< " I ACKNOWLEDGE SATISFACTORY RECEIPT OF SERVICES”<<endl;cout ”? o a o ? e ? 1 ? ” <<e ndl;cout< " °'e ?o a?;?”cin.get();cin.get();void Saving2()

12、char ch;int Tem ;cout "?e? 5 ? "e ?u : ”;cin >Tem;user 。 Ban+=Tem;fstream out("acount.dat ”,ios::in|ios::out|ios :binaryout.seekp(i sizeof(user),ios :beg );out 。 write (char 衣)&user,sizeof(user);out 。 close() ;cout< ”t? o ?' ? e ?” <<Te endl ;Sleep(3000);cout< &

13、quot;D eo a,do ? 1 ?e£Y= e ?. N =? ) £ o"< endl ;cin>>ch;if(ch= ' y' | |ch= ' Y')print2 (Tem);RELATIVE);void Drawmoney2( )char ch;int Tem ;cout "? e ?e ?ue ?e? £"± ?D?e ?100卩?e y± ?£"?;cin> Tem;while(Tem100 )cout ” Sorry,?

14、D? e?e?”;cin> Tem;user 。 Ban =Tem ;fstream out("acount.dat",ios::in | ios:out|ios::binary);out.seekp (i*sizeof (user) ,ios ::beg);out 。 write (char *) & user , sizeof(user );out 。 close();cout<< ” ? u 30? ue ?x ?e ; ” <Tem< endl; Sleep (3000 ) ;cout<<"D eo azo

15、o ? 1 ?e ? (y = e ?,n = ?):"cin >ch;if( ch='y'|ch='Y')print2(-Tem );void Change2 ()int tem , j=3 ;cout ”?? e ?e ?卩??.? u ? ”;docin>tem;j- ;if(tem=user。 code )cout<< ” ?e ?e ?卩?D?u ?£ o” cin >tem;user 。code=tem;fstreamout("acount.dat",ios:binary | io

16、s : in|ios:out);out.seekp(isizeof(user), ios :beg);out.write( (char )&user,sizeof( user) ;out.close( );cout <"? u ?DT?3e 1| £ ? ' ? u ? " <tem<<endl ;Sleep ( 2000);j=0 ;cout<<" °'e ?o a? u 卩?"cin.get ( );cin 。 get ();elsecout< ” ?u ?'

17、;i ?o ?D?e ?e ? (?1 o D"j <" ' ?e ?e ? u ?d )" while ( j );void Select2()int choice,code;cout <” ?e ?e ?卩?u ?;docin> code ;if(user。 code=code )break ;elsecout<” ?u ?'i ?o£ ?D?e ?e ? ”; while (2 );docout ” ????1|? U "<<endl ;cout " 1 。 e ?±

18、0' ?0卩??n 2. e ?±oe ?n 3 od ?2 e ?" n4. DT? u ?n 5. ?n"<<endl;cout <” ? 1 卩?5 >:"docin> choice;switch ( choice)case 1:Saving2( );break;case 2:Drawmoney2(); break;case 3: cout<<"?'e ? i ? od?a: " user.Ban <endl ; cout"°'e ? o

19、 a?uy?<”endl ; getchar();break;case 4 :Change2(); break;case 5:return ;break;default: cout< ”e?e ?2?o? '£ ?D?e ?e ?;£ o” while(choice> 5| | choice1) ; while ( choice!=5);void TellerMach2()int tem ;char ch ;docout ”?2? e ?o ?DD?0 = e ?£ ?:cin> tem;if ( tem=0 )break;else

20、if(find(tem ) =0 )cout<”?2?e£ ?± ?ATM?i 2?oeu ? ?o ?DD?'£ ?£_' F?u ? 1 D?£ ?o,e ?o a?Ur ?e ?o? 2?£ ?” <<endl ;cin ch ;if(ch ! =' F' | ch=' f')break;else Select2(); while (1);void Management2 ()int choice;cout < < ” ? u ?o ?1|?帕n 1。

21、 o ?DD?a? §o ?n 2. ?n"< <endl;cout << ” ? < 1 u ? 2>:" ;docin> choice;if ( choice=2)return ;else if ( choice=1)ofstream out ( ” acount 。 dat",ios:binary| ios:app );cout<<” ?e ?e ?u ?D?£ o"cin ;user 。 cardnu=cardnumber2 ( ) ;cout <&

22、lt; ” ?u ?o?e ?"< <user.cardnu<<endl;int n;cout< <” n? e ?e ? u ? u ? ( ± ?D?e ?6?): ” ;docin >n;if(n< 100000)cout ” ?u ?e y2?1? £ ?D?e ?e ?£ o; if(n 999999 )cout ” ?u ?1y3O£ ?D?e ?e ?£o”while(n<100000 | n>999999 )user.code=n;user。 Ban=10.0

23、;strcpy(user。 time ,_time( ) );out.write(char *)& user, sizeof(user);out 。 close ( ) ;cout<<" e ? ?,do ? i ?e£? = e ?£ ?n = ? ) £ o"char ch;coutcin ch;if(ch='y'| ch='Y')print2();<"°'e?o? e ?o ?2?hdl;getchar();breakelsecout< ” e ?

24、e ?' ?o£ ?D?e:?e? while ( 1 );int cardnumber1()int n;fstream file( "?o? 。 dat" , ios : :binary|ios:nocreateios : in |ios : :out);if(!file)cout <” Can' t open the file” <endl ;return 0;n=0 while!n)file.read(char*)&n,sizeof( int);int m=0 ; file.seekp(-4,ios:cur);file.w

25、rite(char*) m,sizeof(int) );file 。close ();return n ;void print1( ) system ( ” cls ”);char time 25 ; strcpy(time, _time ( );time24=' 'cout<"AUTOMATIC TELLER MACHINE -HENER BANKING SYSTEM”<endl;cout<<"CARDHOLDER BILL COPY 3? e ?' ? u" endl ;- - -+"cout<

26、endl;"|TERMINAL IDcout "+- -+" endl ;cout <"|CARD TYPE|"<<endl;cout<<” |CARD NUMBER|”endl;cout<<"|cout<”TRENS TYPE|”endlcout <"|BATCH NO. <endl ;cout "|cout<<"+-cout<<" | DATA/TIME|10203| "< endl| CRE

27、DIT CARD OF HENRY BANK| "<<user 。 cardnu <"| "<endl ;| OPEN ACOUNT| 198447| ” <<endl;| "< time< "|” <endl ;cout<< ”+- - - - - - +” <endl ;cout<< ”| CAEDHOLEDER SINATURE|" endl ;cout ” |3?"e ?| ”< endl;cout <” +- - - -

28、 - - - - - - - - -+"<<endl;cout<< ” I ACKNOWLEDGESATISFACTORY RECEIPT OF RELATIVE SERVICES” endl ;cout< "? o a o ? e ? 1 ? endl;cout<<"Press any ken toexit ”;cin.get();cin.get();void print1(int x)system ( ” cls ”);char time25 ;strcpy(time , _time( );time 24 ='

29、 ';cout ” AUTOMATIC TELLER MACHINE - HENER BANKING SYSTEM" <endl; cout ”CARDHOLDER BI LL COPY 3? "e ?' ? u" <e ndl;cout<”+- - - - |10203| " endl ;+" <endl;cout< ”| TERMINAL IDcout<< ” +- - - - - - - - +” endl;cout <" |CARD TYPE|"<

30、<endl;cout <" |CARD NUMBER|" <endl;cout<<”|if(x>0)cout”|TRANS TYPE|"<<endl;else x=x;cout<"|TRANS TYPECASH| ” endl;CREDIT CARD OF HENRY BANK| "< user.cardnu <”| ” <endl ;|DEPOSIT CASH|TAKINGcout "| BATCH NO.198447| ”< endl;cou t<

31、< ”|II ”< endl;cout<<"ITOTAL AMOUNT| " <x <"" endl;cout "|DATA/TIMEI " time<<" I ” <endl;cout< ”+- - - - - - - +”<endl ;cout< ” I CAE DHOLEDER SINATURE|' endl;cout<<"| 3? "e ?|” endl;cout <"+- - - - -

32、- - - - - - - - - - -+" endl;cout ” I ACKNOWLEDGESATISFACTORY RECEIPT OF RELATIVE SERVICES" endl ;cout <"?bi ? o a o ? e ? 1 ?'<e ndl;cout<< ” Press any ken to exit ”;cin 。get() ;cin 。 get( );void Saving1()char ch;int Tem;cout< " Please deliver cash to appointm

33、ent entrance :"cin >Tem; user.Ban+=Tem;fstream out("acount。 dat",ios:inIios:outIios::binary);out.seekp (i*sizeof( user), ios : :beg );out。 write (char ) user, sizeof(user);out。 close ();cout ” tttYou have deposit " Tem<<endl ;Sleep(3000);cout< "Do you want to pri

34、nt£?(Y/N) £ o" endl ;cin>>ch;if (ch=' y' | ch= ='Y') print1(Tem);void Drawmoney1char ch int Tem;cout< " Please input the amount of moneey you wantit must beis the mutipleof 100)cin Tem;while (Tem 100)cout "Sorry cin Tem;, Please input againuser 。 Ban

35、-=Tem; fstream out( ” acount out.seekp(i sizeof。 dat",ios: in|ios : out( user) , ios: :beg );ios : :binary);out.write( char*)&user,sizeof(user );out.close() ;cout <"Please take the cash in 30 seconds; ” Sleep(3000) ;cout< ”Do you w ant a print ? (yn ): ”; cin ch;if (ch=' y

36、9;| | ch=' Y')print1( Tem) ; Tem endl ;void Change1 ( )int tem , j=3 ;cout< ” Please injout you original password" do cin tem ;j ;if ( tem=user 。 code )cout "Please input you new cin tem ;user.code=tem;password £ o” ;fstream out( "acount.dat",ios: :in|ios:out | io

37、s:b in ary)out 。 seekp( i*sizeof( user) , ios:beg);out.write( (char* ) user ,sizeof(user);out.close();cout <"Revise the password successfully, make note of this tem endl;password pleaseSleep(2000);j=0 ;cout "press any key to exit"cin 。 get( );cin.get ( );elsecout <"password

38、 error ,input again chances) ”;while(j ) ;You still have " j "void Select1()int choice , code ;cout "Please input your password "do cin code ;if(user.code=code)break ;elsecout "Password error ,input again " while(2);docout<< ” Choose the business function please&l

39、t;endl ;cout " 1 。 Bank deposit of RMBn 2。 Taking RMB n 3. inquirebalancen 4. Revise the passwordn 5. exitn"<<endlcout< ” Please choose bettween1 to 5 >docin choice;switch(choice )case 1: Saving1(); break ;case 2 : Drawmoney1(); break ;case 3 : cout ”Your balance of acount is :

40、”<user.Ban<endl ; cout< "press any key to exit"<endl ; getchar() ; break; case 4: Change1() case 5 :return ;break;breakdefault : while ( choice>5while( choice!cout ” input error£ ?Please input again£o| choice 1);=5) ;void TellerMach1( )char ch ; docout <"Pl

41、ease insert the bank card£" 0 = cancel £?cin user 。 cardnu ; if(user.cardnu=0)break ;elseif(find(user.cardnu)=0 )cout< ” Sorry £ ?your card isaccepted £ ?£PressF tocontinue £ ?Press enter to exit £ ?" cin >ch ; if(ch!='F'|ch=' endl ;)bre

42、akelse Select1();while( 1 );void Management1( )int choice ;cout "Please choose your business functionsnn 1 Account Businessn 2。 Exitn"<<endl;cout< ” Please choose between <1 to 2>doBank Cardcin> choice if(choice=2)return ; else if(choice=1)ofstream out” acount.dat ” , ios

43、:binaryios : :app) ;cout< ” Please in put your n ame £ o"<user 。 cardnu<endl;cin>> ; user.cardnu=cardnumber1 cout "Your acount is int n;cout<<"nPlease input your password (the length must be6):docin> n;if(n<100000)cout< ” The length of passw

44、ord is too short,please change again £ o”;if ( n>999999)cout<<"The length of password is too large,please change again £ o”; while(n<100000| |n > 999999 );user.code=n;user.Ban=10.0;strcpy( user.time, _time();out 。write(char衣)& user , sizeof(user );out.close( ) ;cout

45、 ” Do you want to print£ ?(y/n) £ o"char ch;cin >ch ;if (ch=' y'|ch='Y')print1() ;cout” Press any key to exit "< endl;getchar();break ;elsecout< ” input error , please input again: while (1);void Chinese()int choicewhile (choice!=1 choice !=2);while(1 );void English()int choice;doco

温馨提示

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

评论

0/150

提交评论