try
{
Console.Write("请输入您的生日");
DateTime a = DateTime.Parse(Console.ReadLine());//闰年限定
DateTime b = DateTime.Today;
int ayear = a.Year;
int amonth = a.Month;
int aday = a.Day;
int byear = b.Year;
TimeSpan c = a - b;
Console.WriteLine(c.TotalDays);
int d = (int)c.TotalDays;
int e = d % 365;
Console.WriteLine(e);
Console.WriteLine("您的生日是今年的第" + a.DayOfYear + "天");
if (byear % 4 != 0 && byear % 400!=0)
{
if (c.TotalDays < 0 && e!=0)
{
Console.WriteLine("今年您的生日已经过了" + "距离您下个生日还有" + (e + 365) + "天");
}
if (c.TotalDays > 0)
{
Console.WriteLine("距离您今年过生日还有" + c.TotalDays + "天");
}
if (e == 0)//不执行
{
Console.WriteLine("祝您生日快乐");
}
}
else
Console.WriteLine("今年没有您的生日哦,请期待下一个闰年吧");
}
catch
{ Console.WriteLine("抱歉,您输入错误"); }
Console.ReadLine();