资源预览内容
第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
亲,该文档总共7页全部预览完了,如果喜欢就下载吧!
资源描述
#include<iostream.h>#include<string.h>#include <windows.h>#include<stdlib.h>#include "stdio.h "#include "conio.h "#include<vector>using std:vector;using namespace std;int clrscr();void doit();void lock();class cust;void passwordInput(char *password);class marketpublic:market(cust& cn):cnsm(cn)bool check(char Number,char Pwd);void change();void getmoney();void savemoney();void fun();void inf();void exitm();private:int n;cust&cnsm;class custpublic:friend class market;cust(char Name,char Num,float Money,char Password);char*get_name();char*get_number();char*get_pwd();float get_money();void set_pwd(char Pwd);void get(float m);void save(float m);private:char name20;char number20;float money;char pwd8;cust:cust(char Name,char Num,float Money,char Password)strcpy(name,Name);strcpy(number,Num);money=Money;strcpy(pwd,Password);char *cust:get_name()return name;char*cust:get_number()return number;float cust:get_money()return money;char*cust:get_pwd()return pwd;void cust:set_pwd(char Pwd)strcpy(pwd,Pwd);void cust:get(float m)money-=m;void cust:save(float m)money+=m;bool market:check(char Number,char Pwd)if(strcmp(Number,cnsm.get_number()=0&&strcmp(Pwd,cnsm.get_pwd()=0)return true;elsereturn false;void market:change()char pwd8,repwd8;n=0;doprintf("n");passwordInput(pwd);pwd6='0'if(!check(cnsm.get_number(),pwd)n+;elsebreak;while(n<3);if(n=3)lock();int t=0;doprintf("n");passwordInput(pwd);pwd6='0'printf("n");passwordInput(repwd);repwd6='0'if(t=strcmp(pwd,repwd)!=0)cout<<"!"<<endl;while(t!=0);cnsm.set_pwd(pwd);cout<<"!"<<endl;void market:getmoney()char m;cout<<"13.5"<<"9.5"<<endl<<" y&n"<<endl;cin>>m;doit();if(cnsm.get_money()-13.5*0.95<0)cout<<"!"<<endl;elseif(m='y')cout<<endl<<""<<endl;cout<<""<<13.5*0.05<<""<<endl;cnsm.get(13.5);elsereturn;void market:inf()char a='a'cout<<""<<cnsm.get_money()<<""<<endl<<""<<endl;getch();if(a!='0')clrscr();cout<<" "<<endl;void market:fun()int n;docout<<endl<<""<<endl;cout<<"1) "<<endl<<"2) "<<endl<<"3) "<<endl<<"4) "<<endl;cin>>n;while(n<1|n>4)cout<<"!"<<endl;cin>>n;switch(n)case 1:change();break;case 2:getmoney();break;case 3:inf();break;case 4:exitm();break;while(true);void lock()cout<<endl<<""<<endl;exit(1);void market:exitm()cout<<endl<<"!"<<endl;exit(0);void main()cust c3=cust("zz","111",5200.3f,"111111"),cust("qq","222",222.3f,"222222"),cust("qq","333",333.3f,"333333");int n=0;char pwd8,number20,ch;int i=0;while(1)cout<<" "<<endl;cout<<endl<<""i=0;docin.get(ch);numberi+=ch;while(ch!='n');numberi-1='0'for(int j=0;j<=10;j+)if(!(strcmp(cj.get_number(),number)printf("");passwordInput(pwd);pwd6='0'if(!(strcmp(cj.get_pwd(),pwd)doit();market mar(cj);mar.fun();elsecout<<""<<endl;n+;if(n=3)lock();cout<<""<<endl;Sleep(3000);clrscr();int clrscr()HANDLE hndl = GetStdHandle(STD_OUTPUT_HANDLE);CONSOLE_SCREEN_BUFFER_INFO csbi;GetConsoleScreenBufferInfo(hndl, &csbi);DWORD written;DWORD N = csbi.dwSize.X * csbi.dwCursorPosit
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号