choosesubject c# switch
更新時(shí)間:2009年07月03日 15:56:21 作者:
c# switch 實(shí)例代碼。
復(fù)制代碼 代碼如下:
using System;
class ChooseSubject
{
static void Main()
{
int i;
string str;
Console.WriteLine ("Please choose your favorite subjects:-1 is quit.");
Console.WriteLine ("1.Chinese.");
Console.WriteLine ("2.Maths.");
Console.WriteLine ("3.English.");
Console.WriteLine ("4.Physical.");
Console.WriteLine ("-1 is quit.");
do
{
str=Console.ReadLine ();
i=Int32.Parse (str);
switch(i)
{
case 1:
Console.WriteLine ("You like chinese very much.");
break;
case 2:
Console.WriteLine ("You like maths very much.");
break;
case 3:
Console.WriteLine ("You like english very much.");
break;
case 4:
Console.WriteLine ("You like physical very much.");
break;
case -1:
break;
default:
Console.WriteLine ("I'm sorry.You can't choose this subject.");
break;
}
}while(i!=-1);
Console.WriteLine ("Byebye!");
}
}
相關(guān)文章
C#?二進(jìn)制序列化和反序列化的具體實(shí)現(xiàn)
本文主要介紹了C#?二進(jìn)制序列化和反序列化的具體實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06
Unity延時(shí)執(zhí)行的多種方法小結(jié)
本文主要介紹了4種延時(shí)執(zhí)行的方法,主要包括Update計(jì)時(shí)器,Invoke,協(xié)程,DoTween,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-07-07
C#創(chuàng)建WCF服務(wù)控制臺(tái)應(yīng)用程序詳解
這篇文章主要為大家詳細(xì)介紹了C#創(chuàng)建WCF服務(wù)控制臺(tái)應(yīng)用程序,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07
深入分析緩存依賴中cachedependency對(duì)象及周邊小講
本篇文章是對(duì)緩存依賴中cachedependency對(duì)象進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06
Unity實(shí)現(xiàn)簡(jiǎn)單虛擬搖桿
這篇文章主要為大家詳細(xì)介紹了Unity實(shí)現(xiàn)簡(jiǎn)單虛擬搖桿,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-04-04
C#學(xué)習(xí)基礎(chǔ)概念二十五問 11-15
C#學(xué)習(xí)基礎(chǔ)概念二十五問 11-15...2007-04-04

