namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
#region
// //有一对幼兔,幼兔一个月后长成小兔,小兔一个月后长成成兔。并生下一对幼兔,
//// 问几年后,有多少对幼兔,多少对小兔,多少对成兔,兔子总数是多少?
// // 成兔每月生一对幼兔。
// Console.WriteLine("请输入月份");
// int MM = int.Parse(Console.ReadLine());
// int ct = 0;//成兔初始化
// int xt = 0;//小兔初始化
// int yt = 1;//幼兔刚开始有一只
// int zs = 1;//总数开始一只
// 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+"个月后"+"\n"+"成兔个数为"+ct+"\n"+"小兔个数为"+xt+"\n"+
// "幼兔个数为"+yt+"\n"+"总数为"+zs);
//Console.ReadLine();
#endregion
#region
////显示时间,显示,日、月、时、分、秒。
//DateTime dt = DateTime.Now;
//Console.WriteLine(dt);
//Console.ReadLine();
//显示年,月、日、时、分、秒。
//DateTime dt = DateTime.Now;
//string s;
//s = dt.ToString("yyyy年MM月dd日hh时mm分ss秒");
//Console.WriteLine(s);
//Console.ReadLine();
#endregion
////输入一个 日期判断是否正确
//try catch 异常语句使用
Console.Write("请输入一个日期");
string d = Console.ReadLine();
try
{
DateTime dt = new DateTime();
dt = DateTime.Parse(d);
Console.Write("输入正确");
}
catch
{
Console.Write("输入有误");
}
Console.ReadLine();
}
}
}