手机
当前位置:查字典教程网 >编程开发 >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#中判断字符串是不是数字或字母的方法

C#实现的最短路径分析

C# 一个WCF简单实例

C# 向二进制文件进行读写的操作方法

C# 抓取网页内容的方法

c# 对windows用户和组操作实例

C#日期转换函数分享

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

c#获取本机的IP地址的代码

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

精品推荐
分类导航