zoukankan      html  css  js  c++  java
  • c#判断一个时间的时间段

        

            static void Main(string[] args)

            {

                while (true)

                {

                    int a;

                    Random r = new Random();

                    a = r.Next(0,24);

                      Console.WriteLine(a);

                    if (a >= 0 && a < 6)

                    {

                        Console.WriteLine("凌晨"+a+"点");

                    }

                    else if (a >= 6 && a < 12)

                    {

                        Console.WriteLine("上午" + a + "点");

                    }

                    else if (a >= 12 && a < 18)

                    {

                        Console.WriteLine("下午" + (a-12) + "点");

                    }

                    else if (a >= 18 && a <= 24)

                    {

                        Console.WriteLine("晚上" + (a - 12) + "点");

                    }

                    else

                    {

                        Console.WriteLine("对不起,出错了");

                    } 

                }

  • 相关阅读:
    洛谷P2402 奶牛隐藏
    BZOJ2150: 部落战争
    HDU 6405 Make ZYB Happy(广义SAM)
    CodeForces
    2019CCPC秦皇岛 E题 Escape(网络流)
    2019CCPC秦皇岛D题 Decimal
    2019CCPC秦皇岛I题 Invoker(DP)
    2019CCPC秦皇岛 F Forest Program
    2019CCPC秦皇岛 J MUV LUV EXTRA(KMP)
    2019CCPC秦皇岛 K MUV LUV UNLIMITED(博弈)
  • 原文地址:https://www.cnblogs.com/w-wz/p/4439004.html
Copyright © 2011-2022 走看看