C + + Course Design -- restaurant ordering system (MFC)

Lesson title Restaurant order system ...
Lesson title
Class setting requirements
Program operation interface
Core source code

Lesson title

Restaurant order system

Class setting requirements

  1. user management
  2. Membership registration
  3. Restaurant food category management
  4. Input, delete, modify and save the basic information (No., name, category, unit price) of dishes to a text file
  5. Fuzzy query based on dish category and name
  6. Customer ordering information (time, table number, dish number, quantity) management
  7. Customer checkout (discount for members)
  8. Count the sales volume of a dish one day
  9. Statistics of restaurant turnover by month, quarter and year
  10. System announcement management

Program operation interface



Core source code

// TotalDlg.cpp : implementation file // #include "stdafx.h" #include "Order.h" #include "TotalDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CTotalDlg dialog CTotalDlg::CTotalDlg(CWnd* pParent /*=NULL*/) : CDialog(CTotalDlg::IDD, pParent) { //{{AFX_DATA_INIT(CTotalDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CTotalDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTotalDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CTotalDlg, CDialog) //{{AFX_MSG_MAP(CTotalDlg) ON_BN_CLICKED(IDC_BUTTON8, OnButton8) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON7, OnButton7) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTotalDlg message handlers void CTotalDlg::OnButton8() { // TODO: Add your control notification handler code here EndDialog(TRUE); } void CTotalDlg::OnButton1() { // TODO: Add your control notification handler code here CString str; //get SysTime CTime tm; tm=CTime::GetCurrentTime(); str=tm.Format("%Y-%m-%d"); FILE *file=fopen("sale.txt","r"); int a=0; char date[20];char money[10]; float m=0; while(!feof(file)) { fscanf(file,"%s%s",&date,&money); if(strcmp(date,str)==0) { m = m+atof(money); } } fclose(file); CString aaa; aaa.Format("The sales volume of the day is:%f",m); MessageBox(aaa); } void CTotalDlg::OnButton2() { // TODO: Add your control notification handler code here FILE *file=fopen("sale.txt","r"); int a=0; char date[20];char money[10]; float m=0; while(!feof(file)) //If the file is opened successfully { fscanf(file,"%s%s",&date,&money); //Input file contents into memory CString d = date; //Give date value to d if(strcmp(d.Left(7),"2019-12")==0) //Judge whether it is December 2019 { m = m+atof(money); //Statistics of monthly income } } fclose(file); //Close file CString aaa; aaa.Format("The sales volume of the current month is:%f",m); MessageBox(aaa); } void CTotalDlg::OnButton7() { FILE *file=fopen("sale.txt","r"); int a=0; char date[20];char money[10]; float m=0; while(!feof(file)) { fscanf(file,"%s%s",&date,&money); CString d = date; if(strcmp(d.Left(7),"2019-10")==0||strcmp(d.Left(7),"2019-11")==0||strcmp(d.Left(7),"2019-12")==0) { m = m+atof(money); } } fclose(file); CString aaa; aaa.Format("Sales in the current quarter:%f",m); MessageBox(aaa); }
Sea bombardment 155 original articles published, praised 103, visited 50000+ Private letter follow

8 February 2020, 09:29 | Views: 5587

Add new comment

For adding a comment, please log in
or create account

0 comments