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("对不起,出错了");
                }

              }
        }
    }
}

相关文章:

  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-09-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
猜你喜欢
  • 2022-01-25
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-12-05
相关资源
相似解决方案