zoukankan      html  css  js  c++  java
  • try判断是不是闰年try-catch

    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace ConsoleApplication8
    {
        class Program
        {
            static void Main(string[] args)
            {
                while (true)
                {
                    string rn = Console.ReadLine();
                    string s = "";
                    try
                    {
                        DateTime rn1 = Convert.ToDateTime(rn + "-2-29");系统自动判断,根据系统时间
                        s = "年是闰年";
                    }
                    catch (Exception)
                    {
                        s = "年不是闰年";
                    }
                    finally
                    {
                        Console.WriteLine(rn+s);
                    }
                }
            }
        }
    }
    二百个不间断的重复,只是让我看到了人的命运无法改变这一事实而已。
  • 相关阅读:
    练习题
    练习
    2.15
    数组
    java聊天工具12.4
    11.13(2)
    11.13
    10.30 作业
    10.23
    面向对象
  • 原文地址:https://www.cnblogs.com/dlexia/p/4389060.html
Copyright © 2011-2022 走看看