订餐系统c++代码.doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
订餐系统代码 #includeiostream #includefstream #includeiomanip #includecstring using namespace std; //菜单种类最大值 #define MAX 20 int static m=0; int static i=0; int static pass=0; int compare(char *a,char *b)//比对用户名和密码 {for(int i=0;i20;i++) {if(*a++!=*b++)return 0;} return 1;//完全匹配 } //客户信息 struct Client { char name[20]; char password[20]; }; //注册会员(存储客户信息)用户登入 void Register( ) { Client user; int n; cout您是否为会员?(0否 or 1是)endl; cinn; if(n==0) { cout**********用户注册模块***********endl请输入.....endl注册用户名:; ofstream client(用户信息.txt); if(!client){cout用户信息打开失败!endl;return;} cinuser.name; cout注册密码:; cinuser.password; //保存用户信息 client_user.name,user.passwordendl; cout注册成功!endl; pass=1; } else{ cout请输入.....endl; cout用户名:; cinuser.name; coutendl密码:;cinuser.password; ifstream guest(用户信息.txt); if(!guest){cout用户信息.txt打开失败!endl;return;} //比对输入的用户信息和已存储的用户信息 char name[20],password[20],ch; int i=0,j=0; while(guestchj20) { for( i=0;i20;i++) {if(ch==,)break; if(ch==_)guestch; name[i]=ch; } for(i=0;i20;i++) {if(ch==_)break; if(ch==,)guestch; password[i]=ch; } if((compare(user.name,name)==1)(compare(user.password,password)==1)) {cout用户登入成功!endl;pass=1;break;} j++; } if(pass==0){cout登录失败!!!!!请检查用户名和密码输入是否正确!endl;} } } void Convert( )//购物车,今日菜单 { char cf,s[20]; int j=0,k=0; int n; ofstream out(购物车.txt); if(!out){cout购物车.txt打开失败!endl;return ;} ofstream Menu(今日菜单.txt); if(!Menu){cout今日菜单.txt打开失败!endl;return ;} cout******************************购物车模块********************************endl; cout1 添加菜单名endl 2 购物车内容endl 3 删除菜单名endl 4 生成今日菜单endl 5 退出购物车endl; for(cout...,cinn;n!=5;cout...,cinn)

文档评论(0)

annylsq + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档