简易快餐点餐系统

该系统实现了点餐,结算,使用优惠券等功能

代码如下:

#include
#include
#include
#include
using namespace std;
class food
{
public:
    string name;
    int price;
    food(){}
    food(string n,int p):name(n),price(p){}
};
food zhucan[3]={food("奥尔良鸡腿堡",13),food("奥尔良烤肉饭",13),food("大鸡肉卷",11)};
food fushi[3]={food("黑椒鸡块",9),food("劲爆鸡米花",9),food("大薯条",6)};
food drink[3]={food("可口可乐",5),food("拿铁咖啡",6),food("抹茶红豆奶茶",6)};
class Taocan
{
public:
    string name;
    food tc[3];
    int price;
    Taocan(){}
    Taocan(string n,food a,food b,food c)
    {
        name=n;
        tc[0]=a;
        tc[1]=b;
        tc[2]=c;
        price=a.price+b.price+c.price-10;
    }
};
Taocan taocan[3]={Taocan("鸡腿堡套餐",zhucan[0],fushi[0],drink[0]),Taocan("奥尔良鸡腿饭套餐",zhucan[1],fushi[1],drink[0]),Taocan("鸡肉卷薯条套餐",zhucan[2],fushi[2],drink[0])};
food myshiwu[13];
int mymoney;
int mynum=0;
void write()
{
    ofstream f("list.txuant");
    int i;
    f << "KFC消费清单\n";
    for(i=0;i10)
    {
        cout<<"您本次点餐已经达到上限!如果需要!请结算后继续点餐!"<10)
    {
        cout<<"您本次点餐已经达到上限!如果需要!请结算后继续点餐!"<10)
    {
        cout<<"您本次点餐已经达到上限!如果需要!请结算后继续点餐!"<10)
    {
        cout<<"您本次点餐已经达到上限!如果需要!请结算后继续点餐!"<>m;
    s=m-mymoney;
    while(s<0)
    {
        cout<<"您给的现金不足,还需要"<<0-s<<"元!请继续支付现金!"<>m;
        s=m+s;
    }
    cout<<"支付成功!找零"<>yhq;
    if(yhq=="10086")
    {
        cout<<"您已成功使用5元优惠券!"<

 

你可能感兴趣的:(C++)