Homework!---判断多久过生日

try{
Consloe.Write("请输入您的生日");
string s=Consloe.Readline();
DateTime bd=Covnert.ToDateTime(s);
DateTime td=DateTime.Today;
if(bd>td)
{
TimeSpan Ts1=bd-td;
Consloe.WriteLine("据您的生日天数有"+ts1.TotalDays+"");
 
}

else
{
TimeSpan Ts2=bd。AddYears(1)-td;
Consloe.WriteLine("此时据您的生日天数有"+ts2.TotalDays+"");
 
Console.ReadLine();
}
}
catch(Exception ex)
{Consloe.WriteLine(“报错了哥们”);

Consloe.WriteLine(“错误为:”+ex.Message);
}
finally
{
Consloe.WriteLine(“请填入准确日期”+“谢谢!”);
}
Console.ReadLine();

 

posted on 2015-08-08 07:27  闫科达  阅读(203)  评论(0编辑  收藏  举报

导航