欢迎来到天天文库
浏览记录
ID:10856005
大小:32.50 KB
页数:3页
时间:2018-07-08
《c++ 实现的atm取款机模拟器》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#includeusingnamespacestd;classcostum{private:longnumber;intpassword;charname[10];floatmoney;public:friendclassATM;costum(longnum,intpw,charnam[],floatm);longget_number();char*get_name();intget_password();floatget_money();voidmodify_password(intpw){pas
2、sword=pw;}floatget_yumoney(floatmoney,floatmoney1){money-=money1;returnmoney;}};costum::costum(longnum,intpw,charnam[],floatm){number=num;password=pw;strcpy(name,nam);money=m;}longcostum::get_number(){returnnumber;}char*costum::get_name(){returnname;}intcostum::get_password(){re
3、turnpassword;}floatcostum::get_money(){returnmoney;}classATM{private:inttime;costumc;public:ATM(costumc1):c(c1){}voidlogin(){time=0;cout<<"★★★★★welcometouse★star★ATM!★★★★★"<<'';}inttest_password(intpassword1);voidjiemian();};voidATM::jiemian(){cout<<"1."<<"取款"<<'';cout<<"2."
4、<<"查看余额"<<'';cout<<"3."<<"修改密码"<<'';cout<<"4."<<"退出"<<'';}intATM::test_password(intpassword1){if(password1==c.get_password()){cout<<"卡号:"<5、n();}else{do{cout<<"密码错误,请重新输入!"<<'';cout<<"请输入密码:";cin>>password1;++time;if(password1==c.get_password()){cout<<"卡号:"<6、);if(time>=3){cout<<"对不起,您的卡已被吞掉!"<<'';return1;}}return0;}intmain(){longnumber1;intpassword1;intm1;intop1;intmoney1;intpw2,pw3;inttime=0;costumc1(123456,10086,"wang",5210.00);ATMA(c1);A.login();cout<<"请输入卡号:";cin>>number1;if(number1==c1.get_number()){gotopp;}else{do{cout<<"卡号错7、误,请重新输入!"<<'';cout<<"请输入卡号:";cin>>number1;++time;if(number1==c1.get_number()){gotopp;}}while(time<3);if(time>=3){cout<<"对不起,您的卡已被吞掉!"<<'';return1;}}pp:cout<<"请输入密码:";cin>>password1;intd=A.test_password(password1);if(d==1)exit(1);else{m1=c1.get_money();cout<<"请选择您的操作:";cin>>o8、p1;while(op1!=4){switch(op1){case1:cout<<"请输入您要
5、n();}else{do{cout<<"密码错误,请重新输入!"<<'';cout<<"请输入密码:";cin>>password1;++time;if(password1==c.get_password()){cout<<"卡号:"<6、);if(time>=3){cout<<"对不起,您的卡已被吞掉!"<<'';return1;}}return0;}intmain(){longnumber1;intpassword1;intm1;intop1;intmoney1;intpw2,pw3;inttime=0;costumc1(123456,10086,"wang",5210.00);ATMA(c1);A.login();cout<<"请输入卡号:";cin>>number1;if(number1==c1.get_number()){gotopp;}else{do{cout<<"卡号错7、误,请重新输入!"<<'';cout<<"请输入卡号:";cin>>number1;++time;if(number1==c1.get_number()){gotopp;}}while(time<3);if(time>=3){cout<<"对不起,您的卡已被吞掉!"<<'';return1;}}pp:cout<<"请输入密码:";cin>>password1;intd=A.test_password(password1);if(d==1)exit(1);else{m1=c1.get_money();cout<<"请选择您的操作:";cin>>o8、p1;while(op1!=4){switch(op1){case1:cout<<"请输入您要
6、);if(time>=3){cout<<"对不起,您的卡已被吞掉!"<<'';return1;}}return0;}intmain(){longnumber1;intpassword1;intm1;intop1;intmoney1;intpw2,pw3;inttime=0;costumc1(123456,10086,"wang",5210.00);ATMA(c1);A.login();cout<<"请输入卡号:";cin>>number1;if(number1==c1.get_number()){gotopp;}else{do{cout<<"卡号错
7、误,请重新输入!"<<'';cout<<"请输入卡号:";cin>>number1;++time;if(number1==c1.get_number()){gotopp;}}while(time<3);if(time>=3){cout<<"对不起,您的卡已被吞掉!"<<'';return1;}}pp:cout<<"请输入密码:";cin>>password1;intd=A.test_password(password1);if(d==1)exit(1);else{m1=c1.get_money();cout<<"请选择您的操作:";cin>>o
8、p1;while(op1!=4){switch(op1){case1:cout<<"请输入您要
此文档下载收益归作者所有