C#實(shí)現(xiàn)一個(gè)控制臺(tái)的點(diǎn)餐系統(tǒng)
更新時(shí)間:2019年11月26日 17:14:52 作者:王夢(mèng)翰
這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)一個(gè)控制臺(tái)的點(diǎn)餐系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(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("歡迎來吃飯");
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("請(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)的是千頁豆腐 18元");
price += 18;
}
if (index == 4)
{
Console.WriteLine("您點(diǎn)的是螞蟻上樹 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)注專題《管理系統(tǒng)開發(fā)》。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
C#中DateTime的時(shí)間加減法操作小結(jié)
本文主要介紹了C#中DateTime的時(shí)間加減法操作小結(jié),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07
C#用websocket實(shí)現(xiàn)簡(jiǎn)易聊天功能(客戶端)
這篇文章主要為大家詳細(xì)介紹了C#用websocket實(shí)現(xiàn)簡(jiǎn)易聊天功能,客戶端方向,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02
C# 文件操作函數(shù) 創(chuàng)建文件 判斷存在
本文列舉了C#中文件操作中常用的函數(shù),創(chuàng)建文件和判斷文件存不存在的基本使用,簡(jiǎn)單實(shí)用,希望能幫到大家。2016-05-05
winform異型不規(guī)則界面設(shè)計(jì)的實(shí)現(xiàn)方法
這篇文章主要介紹了winform異型不規(guī)則界面設(shè)計(jì)的實(shí)現(xiàn)方法,具有不錯(cuò)的實(shí)用價(jià)值,需要的朋友可以參考下2014-08-08

