手机
当前位置:查字典教程网 >编程开发 >C#教程 >choosesubject c# switch
choosesubject c# switch
摘要:复制代码代码如下:usingSystem;classChooseSubject{staticvoidMain(){inti;stringst...

复制代码 代码如下:

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!");

}

}

【choosesubject c# switch】相关文章:

C# 抓取网页内容的方法

用.NET创建Windows服务的方法第1/2页

基于C# MBG 扩展方法类库的使用详解

深入理解c# checked unchecked 关键字

Repeater控件绑定的三种方式

c# 通过经纬度查询 具体的地址和区域名称

C#中HashTable的定义与使用方法

C# 委托(delegate) 的小例子

深入C#任务管理器中应用程序选项隐藏程序本身的方法详解

C#简单快速的json组件fastJSON使用介绍

精品推荐
分类导航