c++超市购物系统

上传人:206****923 文档编号:90599981 上传时间:2019-06-13 格式:DOC 页数:7 大小:5.83KB
返回 下载 相关 举报
c++超市购物系统_第1页
第1页 / 共7页
c++超市购物系统_第2页
第2页 / 共7页
c++超市购物系统_第3页
第3页 / 共7页
c++超市购物系统_第4页
第4页 / 共7页
c++超市购物系统_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《c++超市购物系统》由会员分享,可在线阅读,更多相关《c++超市购物系统(7页珍藏版)》请在金锄头文库上搜索。

1、#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);

2、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*

3、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:ge

4、t_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()

5、=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=&#

6、39;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<&l

7、t;" 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;vo

8、id 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<

9、;<"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

10、 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,

11、"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+

12、)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

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号