美文网首页
c#输入一个生日日期,输出其星座.

c#输入一个生日日期,输出其星座.

作者: Class_Lee | 来源:发表于2018-01-02 10:08 被阅读0次

Console.WriteLine ("月");

string month = Console.ReadLine ();

Console.WriteLine ("日");

int day = int.Parse (Console.ReadLine ());

switch (month) {

case "1":

//摩羯座 水瓶座

if (day >= 1 && day <= 19) {

Console.WriteLine ("摩羯座");

} else if (day >= 20 && day <= 31) {

Console.WriteLine ("水瓶座");

} else {

Console.WriteLine ("输入日期有误!");

}

break;

case "2":

break;

default:

break;

}

相关文章

网友评论

      本文标题:c#输入一个生日日期,输出其星座.

      本文链接:https://www.haomeiwen.com/subject/zgkfnxtx.html