C#實(shí)現(xiàn)一個(gè)控制臺(tái)的點(diǎn)餐系統(tǒng)
本文實(shí)例為大家分享了C#點(diǎn)餐系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 控制臺(tái)操作嘗試 { class Program { static void Main(string[] args) { int price = 0; Console.WriteLine("歡迎來(lái)吃飯"); Console.WriteLine("==================================================================="); Console.WriteLine("1.糖醋里脊 24元"); Console.WriteLine("2 紅燒茄子 14元"); Console.WriteLine("3.千頁(yè)豆腐 18元"); Console.WriteLine("4.螞蟻上樹(shù) 20元"); Console.WriteLine("5.紅燒豬蹄 36元"); Console.WriteLine("6.宮保雞丁 32元"); Console.WriteLine("==================================================================="); Console.WriteLine("請(qǐng)按菜品序號(hào)點(diǎn)餐,0號(hào)鍵結(jié)算"); Console.WriteLine("==================================================================="); while (true) { int index = int.Parse(Console.ReadLine()); if (index==1) { Console.WriteLine("您點(diǎn)的是糖醋里脊 24元"); price += 24; } if (index == 2) { Console.WriteLine("您點(diǎn)的是紅燒茄子 14元"); price += 14; } if (index ==3) { Console.WriteLine("您點(diǎn)的是千頁(yè)豆腐 18元"); price += 18; } if (index == 4) { Console.WriteLine("您點(diǎn)的是螞蟻上樹(shù) 20元"); price += 20; } if (index == 5) { Console.WriteLine("您點(diǎn)的是紅燒豬蹄 36元"); price += 36; } if (index == 6) { Console.WriteLine("您點(diǎn)的是宮保雞丁 32元"); price += 32; } if (index ==0) { Console.WriteLine("您總共消費(fèi){0}元",price); } } //Console.ReadLine(); } } }
效果圖:
更多學(xué)習(xí)資料請(qǐng)關(guān)注專(zhuān)題《管理系統(tǒng)開(kāi)發(fā)》。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
C#語(yǔ)法相比其它語(yǔ)言比較獨(dú)特的地方(三)
這篇文章主要介紹了C#語(yǔ)法相比其它語(yǔ)言比較獨(dú)特的地方(三),本文講解了在C++中允許從一個(gè)case貫穿到另一個(gè)case標(biāo)簽、as和is只會(huì)檢測(cè)待轉(zhuǎn)化類(lèi)型的類(lèi)型,而不會(huì)進(jìn)行其它操作等內(nèi)容,需要的朋友可以參考下2015-04-04C#中DateTime的時(shí)間加減法操作小結(jié)
本文主要介紹了C#中DateTime的時(shí)間加減法操作小結(jié),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07C#用websocket實(shí)現(xiàn)簡(jiǎn)易聊天功能(客戶(hù)端)
這篇文章主要為大家詳細(xì)介紹了C#用websocket實(shí)現(xiàn)簡(jiǎn)易聊天功能,客戶(hù)端方向,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02C# 文件操作函數(shù) 創(chuàng)建文件 判斷存在
本文列舉了C#中文件操作中常用的函數(shù),創(chuàng)建文件和判斷文件存不存在的基本使用,簡(jiǎn)單實(shí)用,希望能幫到大家。2016-05-05winform異型不規(guī)則界面設(shè)計(jì)的實(shí)現(xiàn)方法
這篇文章主要介紹了winform異型不規(guī)則界面設(shè)計(jì)的實(shí)現(xiàn)方法,具有不錯(cuò)的實(shí)用價(jià)值,需要的朋友可以參考下2014-08-08