5.16 Bunny Rabbit, Date time practice

Source: Internet
Author: User
Tags try catch

namespaceconsoleapplication8{classProgram {Static voidMain (string[] args) {            #region            //    //There are a pair of young rabbits, the young rabbits grow into a rabbit one months later, one months after the rabbit into a rabbit. and gave birth to a pair of young rabbits,            ////q How many pairs of rabbits, how many pairs of rabbits, how many pairs of rabbits, and how many rabbits are in a few years?             // //The rabbit has a pair of young rabbits a month. //Console.WriteLine ("Please enter the month"); //int MM = Int.            Parse (Console.ReadLine ()); //int ct = 0;//into a rabbit to initialize//int xt = 0;//Bunny Initialization//int yt = 1;//The baby Rabbit was just beginning to have a//int ZS = 1;//The total begins with a//for (int i = 1; I <= mm;i++)//    {            //if (i== 1)//        {            //ct = 0; //xt = 0; //YT = 1; //ZS = 1; //        }            //Else//        {            //ct = ct + xt; //XT =yt; //YT = ct; //ZS = ct + xt + YT; //        }            //    }            //Console.WriteLine (mm+ "months later" + "\ n" + "into the rabbit number is" +ct+ "\ n" + "Rabbit number is" +xt+ "\ n" +//"The number of young rabbits is" +yt+ "\ n" + "Total is" +zs); //console.readline ();            #endregion            #region            ////Display time, display, day, month, hour, minute, second.             //DateTime dt = DateTime.Now; //Console.WriteLine (DT); //Console.ReadLine (); //Displays the year, month, day, time, minute, and second. //DateTime dt = DateTime.Now; //string S; //s = dt.            ToString ("yyyy mm month DD Day hh" mm minutes ss seconds "); //Console.WriteLine (s); //console.readline ();            #endregion            ////Enter a date to determine if it is correct            //The try catch Exception statement uses theConsole.Write ("Please enter a date"); stringD =Console.ReadLine (); Try{DateTime dt=NewDateTime (); DT=DateTime.Parse (d); Console.Write ("Enter the correct"); }            Catch{Console.Write ("wrong input");        } console.readline (); }    }}

5.16 Bunny Rabbit, Date time practice

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.