我是靠谱客的博主 彪壮龙猫,这篇文章主要介绍C#实现一个控制台的点餐系统,现在分享给大家,希望可以做个参考。

本文实例为大家分享了C#点餐系统的具体代码,供大家参考,具体内容如下

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 控制台操作尝试 { class Program { static void Main(string[] args) { int price = 0; Console.WriteLine("欢迎来吃饭"); Console.WriteLine("==================================================================="); Console.WriteLine("1.糖醋里脊 24元"); Console.WriteLine("2 红烧茄子 14元"); Console.WriteLine("3.千页豆腐 18元"); Console.WriteLine("4.蚂蚁上树 20元"); Console.WriteLine("5.红烧猪蹄 36元"); Console.WriteLine("6.宫保鸡丁 32元"); Console.WriteLine("==================================================================="); Console.WriteLine("请按菜品序号点餐,0号键结算"); Console.WriteLine("==================================================================="); while (true) { int index = int.Parse(Console.ReadLine()); if (index==1) { Console.WriteLine("您点的是糖醋里脊 24元"); price += 24; } if (index == 2) { Console.WriteLine("您点的是红烧茄子 14元"); price += 14; } if (index ==3) { Console.WriteLine("您点的是千页豆腐 18元"); price += 18; } if (index == 4) { Console.WriteLine("您点的是蚂蚁上树 20元"); price += 20; } if (index == 5) { Console.WriteLine("您点的是红烧猪蹄 36元"); price += 36; } if (index == 6) { Console.WriteLine("您点的是宫保鸡丁 32元"); price += 32; } if (index ==0) { Console.WriteLine("您总共消费{0}元",price); } } //Console.ReadLine(); } } }

效果图:

更多学习资料请关注专题《管理系统开发》。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持靠谱客。

最后

以上就是彪壮龙猫最近收集整理的关于C#实现一个控制台的点餐系统的全部内容,更多相关C#实现一个控制台内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(148)

评论列表共有 0 条评论

立即
投稿
返回
顶部