订餐系统代码
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstring>
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;i<20;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;
cin>>n;
if(n==0)
{ cout<<"**********用户注册模块***********"<<endl<<"请输入....."<<endl<<"注册用户名:";
ofstream client("");
if(!client){cout<<"用户信息打开失败!"<<endl;return;}
cin>>;
cout<<"注册密码:";
cin>>;
//保存用户信息
client<<'_'<<<<','<<<<endl;
cout<<"注册成功!"<<endl;
pass=1;
}
else{
cout<<"请输入....."<<endl;
cout<<"用户名:"; cin>>;
cout<<endl<<"密码:";cin>>;
ifstream guest("");
if(!guest){cout<<"!"<<endl;return;}
//比对输入的用户信息和已存储的用户信息
char name[20],password[20],ch;
int i=0,j=0;
while(guest>>ch&&j<20)
{
for( i=0;i<20;i++)
{if(ch==',')break;
if(ch=='_')guest>>ch;
name[i]=ch;
}
for(i=0;i<20;i++)
{if(ch=='_')break;
if(ch==',')guest>>ch;
password[i]=ch;
}
if((compare(,name)==1)&&(compare(,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("");
if(!out){cout<<"!"<<endl;return ;}
ofstream Menu("");
if(!Menu){cout<<"!"<<endl;return ;}
订餐系统c++代码 来自淘豆网www.taodocs.com转载请标明出处.