using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 计算几天过生日 { class Program { static void Main(string[] args) { Console.WriteLine("请输入x月x日"); DateTime dt = DateTime.Now; DateTime bt = DateTime.Parse(Console.ReadLine()); TimeSpan i = dt - bt;//现在-生日 TimeSpan m = bt - dt;//生日-现在 //Console.WriteLine(i.TotalDays); //Console.ReadLine(); if (i.TotalDays > 0) { Console.WriteLine(365 - i.TotalDays); } else { Console.WriteLine(m.TotalDays); } Console.ReadLine(); } } }