訂餐系統(tǒng)c++代碼_第1頁(yè)
訂餐系統(tǒng)c++代碼_第2頁(yè)
訂餐系統(tǒng)c++代碼_第3頁(yè)
訂餐系統(tǒng)c++代碼_第4頁(yè)
訂餐系統(tǒng)c++代碼_第5頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、訂餐系統(tǒng)代碼#include#include#include#includeusing namespace std; /菜單種類最大值#define MAX 20int static m=0;int static i=0;int static pass=0;int compare(char *a,char *b)/比對(duì)用戶名和密碼for(int i=0;i20;i+)if(*a+!=*b+)return 0; return 1;/完全匹配 /客戶信息 struct Client char name20;char password20;/注冊(cè)會(huì)員(存儲(chǔ)客戶信息)&用戶登入void Registe

2、r( ) Client user; int n;cout您是否為會(huì)員?(0否 or 1是)n; if(n=0) cout*用戶注冊(cè)模塊*endl請(qǐng)輸入.endl注冊(cè)用戶名:; ofstream client(用戶信息.txt);if(!client)cout用戶信息打開失敗!; coutuser.password; /保存用戶信息 client_,user.passwordendl; cout注冊(cè)成功!endl; pass=1; else cout請(qǐng)輸入.endl; ; coutendluser.password;ifstream

3、guest(用戶信息.txt);if(!guest)cout用戶信息.txt打開失敗!ch&j20) for( i=0;ich;namei=ch; for(i=0;ich;passwordi=ch; if(compare(,name)=1)&(compare(user.password,password)=1)cout用戶登入成功!endl;pass=1;break; j+; if(pass=0)cout登錄失?。≌?qǐng)檢查用戶名和密碼輸入是否正確!endl; void Convert( )/購(gòu)物車,今日菜單 char cf,s20; int j=0,k=0; int n; of

4、stream out(購(gòu)物車.txt); if(!out)cout購(gòu)物車.txt打開失??!endl;return ;ofstream Menu(今日菜單.txt); if(!Menu)cout今日菜單.txt打開失敗!endl;return ; cout*購(gòu)物車模塊*endl; cout1 添加菜單名endl2 購(gòu)物車內(nèi)容endl3 刪除菜單名endl4 生成今日菜單endl5 退出購(gòu)物車endl; for(coutn;n!=5;coutn) if(n=1) cout-添加菜單名(!結(jié)束輸入):cf; while(cf!=!) outcf; si=cf; /寫購(gòu)物車 outcf; couten

5、dl; out.close();if(n=2)cout-購(gòu)物車內(nèi)容:endl; for(j=0;ji;j+) coutsj,; coutendl; if(n=3)cout-刪除菜單名(!結(jié)束輸入):cf;cf!=!;cincf)/對(duì)比輸入單號(hào)for(j=0;ji;j+)if(sj=cf)sj= ;k=1; if(k=1)cout您的操作成功!endl; if(n=4) /提交訂單 j=0; while(ji)/選擇寫入今日菜單.txt Menusj ;k=3;j+; Menu.close();if(k=3)cout今日菜單生成!ch)if(ch=1&ch=MAX)cout ; coutch;

6、coutch; while(ch!=!) cch; coutendl-謝謝您的留言,我們會(huì)努力做得更好!endl;int main()char n,ch; int i=0,k=0,option; ofstream Message(留言.txt); if(!Message)cout留言.txt打開失??!endl;return 1; ofstream Menu(今日菜單.txt); if(!Menu)cout今日菜單.txt打開失?。ndl;return 1; ifstream y1(新菜推薦.txt); if(!y1)cout新菜推薦.txt打開失??!endl;return 1; ifstre

7、am y2(熱菜推薦.txt); if(!y2)cout熱菜推薦.txt打開失?。ndl;return 1; ifstream y3(食堂動(dòng)態(tài).txt); if(!y3)cout食堂動(dòng)態(tài).txt打開失?。ndl;return 1; ifstream menu(今日菜單.txt); if(!menu)cout今日菜單.txt打開失??!endl;return 1; Register(); if(pass=0)return 1;cout*歡迎進(jìn)入訂餐系統(tǒng)*endl;coutendl1 熱菜推薦endl2 新菜推薦endl 3 購(gòu)物車 endl4 食堂動(dòng)態(tài)endl 5 今日菜單endl6 留言 e

8、ndl 7 退出系統(tǒng)!endl;cout*endl;coutoption;option!=7;coutoption)switch(option) case 1:Show(y1);cout-endl;break;/顯示熱菜推薦 case 2:Show(y2);cout-endl;break;/顯示新菜推薦 case 3:Convert( );break; /錄入您選擇的菜號(hào),輸入完畢可以查看購(gòu)物車 case 4:/顯示食堂動(dòng)態(tài) cout-今日食堂動(dòng)態(tài):-ch) if(ch=,)coutendl;continue; coutch; coutendl-endl; break; case 5: /顯示今日菜單內(nèi)容菜單cout您今日菜單如下:endl;Show(menu); break; case 6:cout按任意鍵開始記錄,以!結(jié)束n; if(n!=!) message(Message)

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論