c++银行业务模拟系统_第1页
c++银行业务模拟系统_第2页
c++银行业务模拟系统_第3页
c++银行业务模拟系统_第4页
c++银行业务模拟系统_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

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

文档简介

1、#include<iostream>#include<fstream>#include<string>#include <time.h>using namespace std;const int aa=70,bb=150,cc=130,dd=50;/²»Í¬ÒµÎñËùÐèʱ¼ästruct data/¿Í»§×ÊÁ&

2、#207;int usetime;/¿Í»§ÔÚÒøÐÐʱ¼äint bianhao;/¿Í»§±àºÅint yewutime;/¿Í»§Ëù°ìÒµÎñʱ¼ästring yewu;/Òµ&#

3、206;ñÃûint yewunum;/ÒµÎñ±êºÅint chutime3;/¿Í»§µ½´ïʱ¼ä£¬chutime0ÊÇÃëÖÓ£¬chutime1ÊÇ·ÖÖÓ£¬chutime

4、2ÊÇʱÖÓint motime3;/¿Í»§À뿪ʱ¼äint windownum;class Bankprivate:int windowsum45; /´°¿ÚÊýlong sumtime; /ËùÓаìÀíÍêÒµÎ

5、;ñ¿Í»§×ܹ²ËùÓÃʱ¼äint suijitime; /×îºóÁ½¸ö¿Í»§¼ä¸ôʱ¼äint stilltime4; /ÿ¸ö´°¿&#

6、218;»¹ÐèµÈ´ýʱ¼äint s,f,m; /·Ö±ðÊÇʱ¡¢·Ö¡¢Ãëint wind5; /wind0ÊÇ¿ÕÏд°¿ÚÊýÁ¿,wind1/2/3/4

7、80;æ·Å¾ßÌå´°¿ÚÃûpublic:Bank(); /³õʼ»¯data kehu900; /8СʱÄÚ×î¶à¿Í»§ÈËÊývoid timelocal(Bank &); /¼Ç&#

8、194;¼Ê±¼äint windows(int,int); /Ϊ¿Í»§ÅŶÓvoid calculatechu(int,Bank&);/¼Ç¼¿Í»§µ½´ïʱ¼ävoid print(int,int ,Bank); /Êä³ö&

9、#191;Í»§Êý¾Ývoid averagetime(int,Bank); /¼ÆËãÆ½¾ùʱ¼ävoid window_dail(); /Êä³ö´°¿ÚÐÅÏ¢int fanhui(Bank &); /ÇóËæ»

10、0;ʱ¼ävoid custerm_dail(int,int,Bank);/Ñ¡Ôñ¿Í»§±àºÅvoid choose(int,int,Bank); /Ñ¡Ôñ²é¿´ÄÚÈÝvoid todaynum(int,int,Bank);/ÏÔʾ½ñ

11、0;Õ¿Í»§Á¿void writetotext(int,Bank);/Îļþº¯Êý²Ù×÷Bank:Bank()/¹¹Ôìs=8;/ʱ¼äf=0;m=0;suijitime=0; /Ëæ»ú¼ä¸ôʱ¼

12、28;sumtime=0; /ËùÓпͻ§ÔÚÒøÐÐËùÓÃʱ¼äÖ®ºÍfor(int i=0;i<4;i+)stilltimei=0; /ÿ¸ö´°¿Ú´¦ÀíÊ£Ï&#

13、194;ÒµÎñ»¹ÐèÒªµÄʱ¼äfor(int j=0;j<5;j+)windowsumij=0; /ÿ¸ö´°¿Ú´¦Àí¿Í»§Êýfor(int a=0;a<5;a+)winda=0; /wind0ÊÇ¿

14、;ÕÏд°¿ÚÊýÁ¿,wind1/2/3/4´æ·Å¾ßÌå´°¿ÚÃûint Bank:fanhui(Bank &wait)suijitime=rand()%60; /¿ÍÈËËæ»úµ½´ïm=m+suijitim

15、e; /m¼´Êǵ±µØÊ±¼äwhile(m/60>=1) /Íê³Éʱ¼ä¸ñʽm=m-60;f+;while(f/60>=1)f=f-60;s+;return s;void Bank:timelocal(Bank &wait) /¼ÇÂ¼ÒøÐÐ&

16、#202;±¼äcout<<"Äúµ½´ïµÄʱ¼äÊÇ: "if(s<10)cout<<"0"<<s<<":"/ÌØ¶¨¸ñʽÊä³öelse cout<<s<<&q

17、uot;:"if(f<10)cout<<"0"<<f<<":"else cout<<f<<":"if(m<10)cout<<"0"<<m<<endl;else cout<<m<<endl;void Bank:averagetime(int x,Bank wait)/¼ÆËãËùÓп&#

18、205;»§µÄƽ¾ùµÈ´ýʱ¼älong aver=0;/ƽ¾ùʱ¼äint fen=0,miao=0;/ƽ¾ùʱ¼äÒÔ·Ö¡¢Ãë±íʾi

19、nt j;sumtime=0;for(j=0;j<x;j+)sumtime=sumtime+wait.kehuj.usetime;/×ܹ²Ê±¼äaver=sumtime/(x);/¼ÆËãfen=aver/60;miao=aver;cout<<"ËùÓпͻ§Æ½¾ùµÈ´ýÁ

20、;Ë "<<fen<<"·Ö"<<miao<<"Ãë!"<<endl<<endl;/Çó¿Õ´°¿ÚÊýint Bank:windows(int x,int i)/xÊǰìÀíÒµÎñµÄ¿

21、05;»§Êý,iÊÇ×îºóһλ¹Ë¿ÍµÄ±àºÅ£¬waitÊÇÖ÷º¯ÊýÀﶨÒåµÄ¶ÔÏóint a,b=1,t=0;f

22、or(a=0;a<5;a+)/³õʼ»¯´°¿Ú¿ÕÏÐÐÅÏ¢winda=0;for(a=0;a<4;a+)stilltimea=stilltimea-suijitime;/ÌØ¶¨´°¿Ú´¦Àí»¹ÐèµÄÊ&

23、#177;¼äµÈÓÚÉϴδ¦ÀíËùÐèµÄʱ¼ä¼õÈ¥Ëæ»úµÈ´ýʱ¼äif(stilltimea<=0) /Èç¹ûÊ

24、77;¼äΪ¸º£¬ÖØÐ¸³Öµstilltimea=0;wind0+; /¿ÕÓà´°¿ÚÊýwindb+=a+1; /Ö¸³öÌØ¶¨µÄ¿ÕÏд°¿

25、8;t=wind0;b=1;while(x<=i && t>0) /´°¿Ú²»¿Õstilltimewindb-1=stilltimewindb-1+kehux.yewutime;/ÌØ¶¨´°¿Ú´¦ÀíÍêÒµÎñËùÐèʱ¼

26、8;µÈÓÚ ´¦ÀíÍêÉÏ´ÎÒµÎñËùÐèʱ¼ä ¼ÓÉÏ ´Ë´ÎÒµÎñʱ¼äkehux.motime0=m;/¿Í»§&#

27、192;뿪ʱµÄÃëÖÓkehux.motime1=f;/¿Í»§À뿪ʱµÄ·ÖÖÓkehux.motime2=s;/¿Í»§À뿪ʱµÄʱÖÓkehu

28、x.usetime=kehux.motime0-kehux.chutime0+(kehux.motime1-kehux.chutime1)*60+(kehux.motime2-kehux.chutime2)*3600+kehux.yewutime;/¿Í»§ÔÚÒøÐеȴýʱ¼äwindowsumwindb-10+;/ÌØ¶¨´°¿Ú

29、;´¦ÀíµÄ¿Í»§Êýwindowsumwindb-1kehux.yewunum+; /ÌØ¶¨´°¿Ú´¦ÀíµÄÒµÎñÊýb+;x+;t-;return x;void Bank:calculatechu(int i,Bank &Custerm)/¿&#

30、205;»§µÄµ½´ïʱ¼äint j;for(j=0;j<3;j+)/³õʼ»¯¿Í»§µ½´ïʱ¼äCusterm.kehui.chutimej=0;Custerm.kehui.chutime0=m;/Ϊ¿Í»§

31、1;½´ïʱ¼ä¸³ÖµCusterm.kehui.chutime1=f;Custerm.kehui.chutime2=s;void Bank:print(int x,int i,Bank Custerm)/Êä³ö¿Í»§ÐÅÏ¢int sec,min,hour;sec=Custerm.kehux.motime0+Custerm.kehux.yewutime;mi

32、n=Custerm.kehux.motime1;hour=Custerm.kehux.motime2;while(sec>=60)sec=sec-60;min+;while(min>=60)min=min-60;hour+;cout<<"ÒÔÏÂÊÇ"<<Custerm.kehux.bianhao<<"ºÅ¿Í»§µÄÏêϸ×&

33、#202;ÁÏ:"<<endl;cout<<"Ñ¡ÔñµÄÒµÎñ:"<<Custerm.kehux.yewu<<endl;cout<<"Ñ¡ÔñµÄÒµÎñËùÐèµÄʱ¼ä:

34、"<<Custerm.kehux.yewutime<<endl;cout<<"¿Í»§µ½´ïµÄʱ¼ä:"for(int k=2;k>0;k-)if(Custerm.kehux.chutimek<10)cout<<"0"<<Custerm.kehux.chutimek<<":"else cout<

35、;<Custerm.kehux.chutimek<<":"if(Custerm.kehux.chutime0<10)cout<<"0"<<Custerm.kehux.chutime0;else cout<<Custerm.kehux.chutime0;cout<<endl;cout<<"¿Í»§À뿪µÄʱ¼ä:&quo

36、t;if(hour<10)cout<<"0"<<hour<<":"/ÌØ¶¨¸ñʽÊä³öelse cout<<hour<<":"if(min<10)cout<<"0"<<min<<":"else cout<<min<<":"

37、if(sec<10)cout<<"0"<<sec<<endl;else cout<<sec<<endl;cout<<endl;void Bank:window_dail()/Êä³ö´°¿Ú°ìÀíÒµÎñµÄÇé¿öint i;while(1)cout<<"

38、ÇëÑ¡Ôñ´°¿Ú(1-4),ÒÔ0½áÊø:"<<endl;cin>>i;if(i=0)system("cls");break;if(i>=5)system("cls");cout<<"ûÓÐÕâ¸ö´°¿Ú&#

39、163;¬ÇëÖØÐÂÑ¡Ôñ"<<endl;elsesystem("cls");cout<<" "<<i<<"´°¿Ú¹²´¦ÀíÁË "<<windowsumi-10<<"ÈË"<

40、;<endl;cout<<"ÆäÖÐ"<<endl;cout<<" ´æ¿îÒµÎñ "<<windowsumi-11<<"ÈË"<<endl;cout<<" È¡¿îÒµÎñ "<<windows

41、umi-12<<"ÈË"<<endl;cout<<" ¹ÒʧҵÎñ "<<windowsumi-13<<"ÈË"<<endl;cout<<" »¹´ûÒµÎñ "<<windowsumi-14<<"

42、ÈË"<<endl;void Bank:todaynum(int x,int i,Bank Custerm)/Êä³ö¿Í»§Á¿cout<<endl<<" ½ñÈÕ¹²À´ÁË"<<i<<"λ¿Í»§!"&

43、lt;<endl;cout<<" ÆäÖÐ,´¦ÀíÁË"<<x<<"λ¿Í»§,»¹ÓÐ"<<i-x<<"λ¿Í»§Î´µÃµ½´¦

44、92;í!"<<endl<<endl;void Bank:custerm_dail(int i,int x,Bank Custerm)/Ñ¡ÔñÊä³öµÄ¿Í»§±àºÅint h;while(1)cout<<"ÇëÊäÈëÄúÏëÖ

45、0;µÀµÄ¿Í»§±àºÅ(ÒÔ 0 ½áÊø):"cin>>h;if(h=0)cout<<endl;break;else if(h>i)system("cls");cout<<"ûÓÐÕâ¸ö±àºÅ,Ç

46、;ëÖØÐÂÑ¡Ôñ!"<<endl<<endl;else if(h>x&&h<i)system("cls");cout<<"ÒøÐÐͣҵǰδ´¦Àí¸Ã¿Í»§!"&

47、lt;<endl<<endl;else system("cls");print(h-1,i,Custerm);void Bank:choose(int x,int i,Bank Custerm)/Ñ¡ÔñÊä³öÏêϸÐÅÏ¢int n;int flag=0;while(1)cout<<" ¡ï ¡ï ¡ï 

48、1;ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï"<<endl;cout<<endl;cout<<" ¡ò 0 Í˳ö ¡ò"<<endl<<endl;cout<<

49、;" ¡ò 1 ²é¿´½ñÈÕÒøÐпͻ§ÊýÁ¿ ¡ò"<<endl<<endl;cout<<" ¡ò 2 µÚnºÅ´°¿ÚµÄÏêÏ

50、¸ÐÅÏ¢ ¡ò"<<endl<<endl;cout<<" ¡ò 3 ¿Í»§Æ½¾ùµÈ´ýʱ¼ä ¡ò"<<endl<<endl;cout<<endl;cout<<" ¡ï 

51、61;ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï"<<endl<<endl;cout<<" ÇëÑ¡Ôñ: "cin>>n;switch(n)case 0

52、:flag=1;break;case 1:system("cls");todaynum(x,i,Custerm);system("pause");system("cls");break;case 2:system("cls");window_dail();break;/ case 3:system("cls");custerm_dail(i,x,Custerm) ;break;case 3:system("cls");averagetime(x,Custerm);system

53、("pause");system("cls");break;default:system("cls");cout<<"ûÓÐÕâ¸öÑ¡ÏÇëÖØÐÂÑ¡Ôñ!"<<endl;break;if(flag=1)break;void Bank:writ

54、etotext(int x,Bank Custerm)/Îļþ²Ù×÷int sec,min,hour;int j=0;char ch;sec=Custerm.kehuj.motime0+Custerm.kehuj.yewutime;min=Custerm.kehuj.motime1;hour=Custerm.kehuj.motime2;while(sec>=60)sec=sec-60;min+;while(min>=60)min=min-60;hour+;cout<<"

55、2;Ç·ñÉú³ÉÎļþ£¿£¨y/n£©: "cin>>ch;if(ch='y')if(x=0)cout<<"Êý¾Ý¼Ç¼Ϊ¿Õ!"<<endl;elseofstream outfile("f1.txt&qu

56、ot;,ios:out);if(!outfile)cout<<"´ò¿ªÊ§°Ü"<<endl;exit(1);while(j<x)outfile<<" * * * * * * * * * * "<<endl;outfile<<" ¿Í»§±àºÅ: "<<kehuj.bianhao<<e

57、ndl;outfile<<" °ìÀíÒµÎñ: "<<kehuj.yewu<<endl;outfile<<" ÒµÎñʱ¼ä: "<<kehuj.yewutime<<endl;outfile<<" µ½´ïʱ¼ä: &q

58、uot;if(kehuj.chutime2<10)outfile<<"0"<<kehuj.chutime2<<":"else outfile<<kehuj.chutime2<<":"if(kehuj.chutime1<10)outfile<<"0"<<kehuj.chutime1<<":"else outfile<<kehuj.chutime1<<":&q

59、uot;if(kehuj.chutime0<10)outfile<<"0"<<kehuj.chutime0<<":"<<endl;else outfile<<kehuj.chutime0<<":"<<endl;outfile<<" À뿪ʱ¼ä: "sec=Custerm.kehuj.motime0+Custerm.kehuj.ye

60、wutime;min=Custerm.kehuj.motime1;hour=Custerm.kehuj.motime2;while(sec>=60)sec=sec-60;min+;while(min>=60)min=min-60;hour+;if(hour<10)outfile<<"0"<<hour<<":"else outfile<<hour<<":"if(min<10)outfile<<"0"<<min&

61、lt;<":"else outfile<<min<<":"if(sec<10)outfile<<"0"<<sec<<":"<<endl;else outfile<<sec<<":"<<endl;j+;outfile.close();cout<<"³É¹¦Éú³ÉÎ&#

62、196;¼þ!"<<endl;int main ()int ff;time_t t = time(0); /ʱ¼äº¯Êýchar tmp64;int x=0,i=0; /iÊÇ×îºóµ½µÄ¿Í»§±àºÅint flag1=1,flag=1,flag2=1; /xÅÅ&

63、#212;Ú×îÇ°ÃæµÄ¿Í»§±àºÅ£¬£¬flag1ÊǵÚÒ»´ÎÑ¡ÏîµÄ¹Ø¼ü±êÖ¾£¬flag±ê

64、4;¾int s=8; /16:00֮ǰӪҵ£¬sÊÇʱÖÓ,mÊÇ×îºóÁ½Î»¿Í»§¼ä¸ôʱ¼äint ch;Bank Custerm;string a="´æ

65、;¿î",b="È¡¿î",c="¹Òʧ",d="»¹´û"/ÒµÎñÃûwhile(flag1)cout<<endl;cout<<" ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï &

66、#161;ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï"<<endl;cout<<endl;cout<<" ¡­¡­¡­¡­0:Í˳ö¡­¡­¡­¡­¡&#

67、173;¡­ "<<endl;cout<<" ¡­¡­¡­¡­1:Ëæ»ú½á¹û¡­¡­¡­¡­ "<<endl;cout<<" ¡­¡­¡­¡­2:Ê

68、8;ÈëÒµÎñ¡­¡­¡­¡­ "<<endl;cout<<" ¡­¡­¡­¡­3:´ÓÎļþ¶ÁÈë¡­¡­¡­¡­"<<end

69、l;cout<<" ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï"<<endl;cout<<" ÇëÑ¡Ôñ: "sca

70、nf("%d",&ch);switch(ch)case 0:exit(0);case 1:flag=0;/Ñ¡ÔñÊÇ·ñʹÓÃϵͳÔÝÍ£º¯Êýflag1=0;/Í£Ö¹±¾ÏîÑ¡Ôñbreak;ca

71、se 2:flag1=0;break;/*case 3:flag1=0;break;*/default:cout<<" ûÓÐÕâ¸öÑ¡Ïî,ÇëÖØÐÂÑ¡Ôñ!"<<endl;system("pause");break;system("cls");while(s)cout<<

72、endl;cout<<endl;cout<<" £þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£&

73、#254;£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ"<<endl;cout<<endl;cout<<" ¡ï ¡ï ¡ï ¡ï ¡ï ¡&

74、#239; ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï"<<endl;cout<<" ¡ï ¡ï ¡

75、9; ¡ï ¡ï ¡ï »¶Ó­À´µ½Ð¡»Ô»ÔÒøÐÐ ¡ï ¡ï ¡ï ¡ï ¡ï ¡ï"<<endl;cout<<" ¡ï ¡ï ¡&#

76、239; ¡ï ¡ï ¡ï"<<endl;cout<<" ¡ï ¡ï"<<endl;cout<<" ¡ï ¡­¡­¡­¡­ 1:´æ ¿î ¡­¡­¡­¡­¡­ ¡

77、;ï"<<endl;cout<<" ¡ï ¡­¡­¡­¡­ 2:È¡ ¿î ¡­¡­¡­¡­¡­ ¡ï"<<endl;cout<<" ¡ï ¡­¡­¡­¡

78、;­ 3:¹Ò ʧ ¡­¡­¡­¡­¡­ ¡ï"<<endl;cout<<" ¡ï ¡­¡­¡­¡­ 4:»¹ ´û ¡­¡­¡­¡­¡­ &#

79、161;ï"<<endl;cout<<" ¡ï ¡­¡­¡­¡­ 0:ÍË ³ö ¡­¡­¡­¡­¡­ ¡ï"<<endl;cout<<endl;cout<<" £þ£þ£

80、4;£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£þ£

81、4;£þ£þ£þ£þ£þ£þ£þ"<<endl;if(flag=1)cin>>ff;elseff=(rand()%4+1);/Ëæ»úÑ¡Ôñ4ÖÖÒµÎñswitch(ff)case 0:system("cls");break;case 1:cout<<

82、;endl;cout<<"* * * * * * * * * * * * * * * "<<endl;strftime(tmp, sizeof(tmp), "%Y/%m/%d %A %z",localtime(&t) );/ÏÔʾµ±µØÊ±¼äµÄº¯Êýputs(tmp);s=Custerm.fanhui(Custerm);if(s>

83、=16)flag2=0;break;Custerm.kehui.bianhao=i+1;/¸³Öµ±àºÅCusterm.kehui.yewu=a;/¸³ÖµÒµÎñÃûCusterm.kehui.yewunum=1;/¸³ÖµÒµÎñ±àºÅCusterm.kehui.yewutime=aa;/&

84、#184;³ÖµÒµÎñËùÓÃʱ¼äCusterm.timelocal(Custerm);/16:00֮ǰӪҵ£¬sÊÇʱÖÓCusterm.calculatechu(i,Custerm);/¼ÆËãµ½´

85、ïʱ¼äx=Custerm.windows(x,i);/xÊÇÅÅÔÚÇ°ÃæµÄ¹Ë¿Í±àºÅi+;cout<<endl<<"ÄúµÄºÅÂëÊÇ: "<<i<<" °ìÀíµÄÊÇ: "<<a<<endl<<endl;cout<<"Äú&

温馨提示

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

评论

0/150

提交评论