#include
using namespace std;
int main()
{
cout << "--------------------自助点单系统--------------------" << endl;
cout << "菜单" << endl;
cout << "1火锅 2回锅肉 3宫保鸡丁 4夫妻肺片 5毛血旺 6麻婆豆腐 7东坡肘子 8水煮牛肉" << endl;
cout << "9龙抄手 10钟水饺 11串串香 12肥肠粉 13担担面" << endl;
cout << "14可乐 15雪碧 16脉动 17果缤纷 18果粒橙 19营养快线" << endl;
cout << "套餐A(优惠10元):火锅 回锅肉 东坡肘子,任选其一" << endl;
cout << "龙抄手 钟水饺 串串香,任选其一" << endl;
cout << "可乐 雪碧,任选其一" << endl;
cout << "套餐B(优惠12元):火锅 回锅肉 东坡肘子 水煮牛肉,任选其一" << endl;
cout << "肥肠粉 担担面,任选其一" << endl;
cout << "脉动 果缤纷 果粒橙,任选其一" << endl;
cout << "本店消费满100元,可加1元,换购一种饮料" << endl;
//选择单点A 套餐B 结账C
char menu;//菜单
int data;//菜名
int price[20] = {0,49,39,24,20,21,15,40,59,10,13,25,12,8,4,4,5,6,8,5};//单个菜品的价格
int Sum[20] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };//储存菜品的数量
while (true)
{
cout << "A单点 B套餐 C结账" << endl;
cin >> menu;
if (menu == 'A')
{
cout << "单点(请输入你想选择的菜品编号,输入0结束单点)" << endl;
while (true)//单点
{
cin >> data;
if (data == 0)
break;
if (data==1)
++Sum[1];
if (data == 2)
++Sum[2];
if (data == 3)
++Sum[3];
if (data == 4)
++Sum[4];
if (data == 5)
++Sum[5];
if (data == 6)
++Sum[6];
if (data == 7)
++Sum[7];
if (data == 8)
++Sum[8];
if (data == 9)
++Sum[9];
if (data == 10)
++Sum[10];
if (data == 11)
++Sum[11];
if (data == 12)
++Sum[12];
if (data == 13)
++Sum[13];
if (data == 14)
++Sum[14];
if (data == 15)
++Sum[15];
if (data == 16)
++Sum[16];
if (data == 17)
++Sum[17];
if (data == 18)
++Sum[18];
if (data == 19)
++Sum[19];
}
for (int i = 0; i < 20; ++i)
{
if (i == 1 && Sum[i] > 0)
cout << "火锅 数量" << Sum[i] << "份 共计" << 49 * Sum[i] << "元" << ";" << endl;
if (i == 2 && Sum[i] > 0)
cout << "回锅肉 数量" << Sum[i] << "份 共计" << 39 * Sum[i] << "元" << ";" << endl;
if (i == 3 && Sum[i] > 0)
cout << "宫保鸡丁 数量" << Sum[i] << "份 共计" << 24 * Sum[i] << "元" << ";" << endl;
if (i == 4 && Sum[i] > 0)
cout << "夫妻肺片 数量" << Sum[i] << "份 共计" << 20 * Sum[i] << "元" << ";" << endl;
if (i == 5 && Sum[i] > 0)
cout << "毛血旺 数量" << Sum[i] << "份 共计" << 21 * Sum[i] << "元" << ";" << endl;
if (i == 6 && Sum[i] > 0)
cout << "麻婆豆腐 数量" << Sum[i] << "份 共计" << 15 * Sum[i] << "元" << ";" << endl;
if (i == 7 && Sum[i] > 0)
cout << "东坡肘子 数量" << Sum[i] << "份 共计" << 40 * Sum[i] << "元" << ";" << endl;
if (i == 8 && Sum[i] > 0)
cout << "水煮牛肉 数量" << Sum[i] << "份 共计" << 59 * Sum[i] << "元" << ";" << endl;
if (i == 9 && Sum[i] > 0)
cout << "龙抄手 数量" << Sum[i] << "份 共计" << 10 * Sum[i] << "元" << ";" << endl;
if (i == 10 && Sum[i] > 0)
cout << "钟水饺 数量" << Sum[i] << "份 共计" << 13 * Sum[i] << "元" << ";" << endl;
if (i == 11 && Sum[i] > 0)
cout << "串串香 数量" << Sum[i] << "份 共计" << 25 * Sum[i] << "元" << ";" << endl;
if (i == 12 && Sum[i] > 0)
cout << "肥肠粉 数量" << Sum[i] << "份 共计" << 12 * Sum[i] << "元" << ";" << endl;
if (i == 13 && Sum[i] > 0)
cout << "担担面 数量" << Sum[i] << "份 共计" << 8 * Sum[i] << "元" << ";" << endl;
if (i == 14 && Sum[i] > 0)
cout << "可乐 数量" << Sum[i] << "份 共计" << 4 * Sum[i] << "元" << ";" << endl;
if (i == 15 && Sum[i] > 0)
cout << "雪碧 数量" << Sum[i] << "份 共计" << 4 * Sum[i] << "元" << ";" << endl;
if (i == 16 && Sum[i] > 0)
cout << "脉动 数量" << Sum[i] << "份 共计" << 5 * Sum[i] << "元" << ";" << endl;
if (i == 17 && Sum[i] > 0)
cout << "果缤纷 数量" << Sum[i] << "份 共计" << 6 * Sum[i] << "元" << ";" << endl;
if (i == 18 && Sum[i] > 0)
cout << "果粒橙 数量" << Sum[i] << "份 共计" << 8 * Sum[i] << "元" << ";" << endl;
if (i == 19 && Sum[i] > 0)
cout << "营养快线 数量" << Sum[i] << "份 共计" << 5 * Sum[i] << "元" << ";" << endl;
}
cout << "总 计" << Sum[0] + 49 * Sum[1] + 39 * Sum[2] + 24 * Sum[3] + 20 * Sum[4] + 21 * Sum[5] + 15 * Sum[6] +
40 * Sum[7] + 59 * Sum[8] + 10 * Sum[9] + 13 * Sum[10] + 25 * Sum[11] + 12 * Sum[12] +
8 * Sum[13] + 4 * Sum[14] + 4 * Sum[15] + 5 * Sum[16] + 6 * Sum[17] + 8 * Sum[18] +
5 * Sum[19] << "元" << "优惠" << -1 * Sum[0] << "元" << endl;
}
if (menu == 'B')
{
char combo;
cout << "请选择套餐A或套餐B(Y/N)" << endl;
cin >> combo;
if (combo == 'Y')
{
cout << "套餐A" << endl;
Sum[0] -= 10;
cout<< "1火锅 2回锅肉 7东坡肘子,任选其一" << endl;
cin >> data;
if (data == 1)
++Sum[1];
if (data == 2)
++Sum[2];
if (data == 7)
++Sum[7];
cout << "9龙抄手 10钟水饺 11串串香,任选其一" << endl;
cin >> data;
if (data == 9)
++Sum[9];
if (data == 10)
++Sum[10];
if (data == 11)
++Sum[11];
cout << "14可乐 15雪碧,任选其一" << endl;
cin >> data;
if (data == 14)
++Sum[14];
if (data == 15)
++Sum[15];
for (int i = 0; i < 20; ++i)
{
if (i == 1 && Sum[i] > 0)
cout << "火锅 数量" << Sum[i] << "份 共计" << 49 * Sum[i] << "元" << ";" << endl;
if (i == 2 && Sum[i] > 0)
cout << "回锅肉 数量" << Sum[i] << "份 共计" << 39 * Sum[i] << "元" << ";" << endl;
if (i == 3 && Sum[i] > 0)
cout << "宫保鸡丁 数量" << Sum[i] << "份 共计" << 24 * Sum[i] << "元" << ";" << endl;
if (i == 4 && Sum[i] > 0)
cout << "夫妻肺片 数量" << Sum[i] << "份 共计" << 20 * Sum[i] << "元" << ";" << endl;
if (i == 5 && Sum[i] > 0)
cout << "毛血旺 数量" << Sum[i] << "份 共计" << 21 * Sum[i] << "元" << ";" << endl;
if (i == 6 && Sum[i] > 0)
cout << "麻婆豆腐 数量" << Sum[i] << "份 共计" << 15 * Sum[i] << "元" << ";" << endl;
if (i == 7 && Sum[i] > 0)
cout << "东坡肘子 数量" << Sum[i] << "份 共计" << 40 * Sum[i] << "元" << ";" << endl;
if (i == 8 && Sum[i] > 0)
cout << "水煮牛肉 数量" << Sum[i] << "份 共计" << 59 * Sum[i] << "元" << ";" << endl;
if (i == 9 && Sum[i] > 0)
cout << "龙抄手 数量" << Sum[i] << "份 共计" << 10 * Sum[i] << "元" << ";" << endl;
if (i == 10 && Sum[i] > 0)
cout << "钟水饺 数量" << Sum[i] << "份 共计" << 13 * Sum[i] << "元" << ";" << endl;
if (i == 11 && Sum[i] > 0)
cout << "串串香 数量" << Sum[i] << "份 共计" << 25 * Sum[i] << "元" << ";" << endl;
if (i == 12 && Sum[i] > 0)
cout << "肥肠粉 数量" << Sum[i] << "份 共计" << 12 * Sum[i] << "元" << ";" << endl;
if (i == 13 && Sum[i] > 0)
cout << "担担面 数量" << Sum[i] << "份 共计" << 8 * Sum[i] << "元" << ";" << endl;
if (i == 14 && Sum[i] > 0)
cout << "可乐 数量" << Sum[i] << "份 共计" << 4 * Sum[i] << "元" << ";" << endl;
if (i == 15 && Sum[i] > 0)
cout << "雪碧 数量" << Sum[i] << "份 共计" << 4 * Sum[i] << "元" << ";" << endl;
if (i == 16 && Sum[i] > 0)
cout << "脉动 数量" << Sum[i] << "份 共计" << 5 * Sum[i] << "元" << ";" << endl;
if (i == 17 && Sum[i] > 0)
cout << "果缤纷 数量" << Sum[i] << "份 共计" << 6 * Sum[i] << "元" << ";" << endl;
if (i == 18 && Sum[i] > 0)
cout << "果粒橙 数量" << Sum[i] << "份 共计" << 8 * Sum[i] << "元" << ";" << endl;
if (i == 19 && Sum[i] > 0)
cout << "营养快线 数量" << Sum[i] << "份 共计" << 5 * Sum[i] << "元" << ";" << endl;
}
cout << "总 计" << Sum[0] + 49 * Sum[1] + 39 * Sum[2] + 24 * Sum[3] + 20 * Sum[4] + 21 * Sum[5] + 15 * Sum[6] +
40 * Sum[7] + 59 * Sum[8] + 10 * Sum[9] + 13 * Sum[10] + 25 * Sum[11] + 12 * Sum[12] +
8 * Sum[13] + 4 * Sum[14] + 4 * Sum[15] + 5 * Sum[16] + 6 * Sum[17] + 8 * Sum[18] +
5 * Sum[19] << "元" <<"优惠"<<-1*Sum[0]<<"元"<< endl;
}
else
{
cout << "套餐B" << endl;
Sum[0] -= 12;
cout << "1火锅 2回锅肉 7东坡肘子 8水煮牛肉,任选其一" << endl;
cin >> data;
if (data == 1)
++Sum[1];
if (data == 2)
++Sum[2];
if (data == 7)
++Sum[7];
if (data == 8)
++Sum[8];
cout << "12肥肠粉 13担担面,任选其一" << endl;
cin >> data;
if (data == 12)
++Sum[12];
if (data == 13)
++Sum[13];
cout << "16脉动 17果缤纷 18果粒橙,任选其一" << endl;
cin >> data;
if (data == 16)
++Sum[16];
if (data == 17)
++Sum[17];
if (data == 18)
++Sum[18];
for (int i = 0; i < 20; ++i)
{
if (i == 1 && Sum[i] > 0)
cout << "火锅 数量" << Sum[i] << "份 共计" << 49 * Sum[i] << "元" << ";" << endl;
if (i == 2 && Sum[i] > 0)
cout << "回锅肉 数量" << Sum[i] << "份 共计" << 39 * Sum[i] << "元" << ";" << endl;
if (i == 3 && Sum[i] > 0)
cout << "宫保鸡丁 数量" << Sum[i] << "份 共计" << 24 * Sum[i] << "元" << ";" << endl;
if (i == 4 && Sum[i] > 0)
cout << "夫妻肺片 数量" << Sum[i] << "份 共计" << 20 * Sum[i] << "元" << ";" << endl;
if (i == 5 && Sum[i] > 0)
cout << "毛血旺 数量" << Sum[i] << "份 共计" << 21 * Sum[i] << "元" << ";" << endl;
if (i == 6 && Sum[i] > 0)
cout << "麻婆豆腐 数量" << Sum[i] << "份 共计" << 15 * Sum[i] << "元" << ";" << endl;
if (i == 7 && Sum[i] > 0)
cout << "东坡肘子 数量" << Sum[i] << "份 共计" << 40 * Sum[i] << "元" << ";" << endl;
if (i == 8 && Sum[i] > 0)
cout << "水煮牛肉 数量" << Sum[i] << "份 共计" << 59 * Sum[i] << "元" << ";" << endl;
if (i == 9 && Sum[i] > 0)
cout << "龙抄手 数量" << Sum[i] << "份 共计" << 10 * Sum[i] << "元" << ";" << endl;
if (i == 10 && Sum[i] > 0)
cout << "钟水饺 数量" << Sum[i] << "份 共计" << 13 * Sum[i] << "元" << ";" << endl;
if (i == 11 && Sum[i] > 0)
cout << "串串香 数量" << Sum[i] << "份 共计" << 25 * Sum[i] << "元" << ";" << endl;
if (i == 12 && Sum[i] > 0)
cout << "肥肠粉 数量" << Sum[i] << "份 共计" << 12 * Sum[i] << "元" << ";" << endl;
if (i == 13 && Sum[i] > 0)
cout << "担担面 数量" << Sum[i] << "份 共计" << 8 * Sum[i] << "元" << ";" << endl;
if (i == 14 && Sum[i] > 0)
cout << "可乐 数量" << Sum[i] << "份 共计" << 4 * Sum[i] << "元" << ";" << endl;
if (i == 15 && Sum[i] > 0)
cout << "雪碧 数量" << Sum[i] << "份 共计" << 4 * Sum[i] << "元" << ";" << endl;
if (i == 16 && Sum[i] > 0)
cout << "脉动 数量" << Sum[i] << "份 共计" << 5 * Sum[i] << "元" << ";" << endl;
if (i == 17 && Sum[i] > 0)
cout << "果缤纷 数量" << Sum[i] << "份 共计" << 6 * Sum[i] << "元" << ";" << endl;
if (i == 18 && Sum[i] > 0)
cout << "果粒橙 数量" << Sum[i] << "份 共计" << 8 * Sum[i] << "元" << ";" << endl;
if (i == 19 && Sum[i] > 0)
cout << "营养快线 数量" << Sum[i] << "份 共计" << 5 * Sum[i] << "元" << ";" << endl;
}
cout << "总 计" << Sum[0] + 49 * Sum[1] + 39 * Sum[2] + 24 * Sum[3] + 20 * Sum[4] + 21 * Sum[5] + 15 * Sum[6] +
40 * Sum[7] + 59 * Sum[8] + 10 * Sum[9] + 13 * Sum[10] + 25 * Sum[11] + 12 * Sum[12] +
8 * Sum[13] + 4 * Sum[14] + 4 * Sum[15] + 5 * Sum[16] + 6 * Sum[17] + 8 * Sum[18] +
5 * Sum[19] << "元" << "优惠" << -1 * Sum[0] << "元" << endl;
}
}
if (menu == 'C')
{
char option;
int payment = Sum[0] + 49 * Sum[1] + 39 * Sum[2] + 24 * Sum[3] + 20 * Sum[4] + 21 * Sum[5] + 15 * Sum[6] +
40 * Sum[7] + 59 * Sum[8] + 10 * Sum[9] + 13 * Sum[10] + 25 * Sum[11] + 12 * Sum[12] +
8 * Sum[13] + 4 * Sum[14] + 4 * Sum[15] + 5 * Sum[16] + 6 * Sum[17] + 8 * Sum[18] +
5 * Sum[19];
if (payment >= 100)
{
cout << "恭喜你消费金额达到100元,是否参与1元换购(T/F)" << endl;
cin >> option;
if (option == 'T')
{
int drink;
cout << "14可乐 15雪碧 16脉动 17果缤纷 18果粒橙 19营养快线,任选其一" << endl;
cin >> drink;
if (drink == 14)
{
++Sum[14]; Sum[0] -= 3;
}
if (drink == 15)
{
++Sum[15]; Sum[0] -= 3;
}
if (drink == 16)
{
++Sum[16]; Sum[0] -= 4;
}
if (drink == 17)
{
++Sum[17]; Sum[0] -= 5;
}
if (drink == 18)
{
++Sum[18]; Sum[0] -= 7;
}
if (drink == 19)
{
++Sum[19]; Sum[0] -= 4;
}
}
}
cout << "总 计" << Sum[0] + 49 * Sum[1] + 39 * Sum[2] + 24 * Sum[3] + 20 * Sum[4] + 21 * Sum[5] + 15 * Sum[6] +
40 * Sum[7] + 59 * Sum[8] + 10 * Sum[9] + 13 * Sum[10] + 25 * Sum[11] + 12 * Sum[12] +
8 * Sum[13] + 4 * Sum[14] + 4 * Sum[15] + 5 * Sum[16] + 6 * Sum[17] + 8 * Sum[18] +
5 * Sum[19] << "元" << "优惠" << -1 * Sum[0] << "元" << endl;
cout << "支付成功 祝你生活愉快 欢迎下次光临本店" << endl;
return 0;
}
}
}