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();
时间: 2024-11-15 00:33:07