static void Main(string[] args)
{
DateTime a = DateTime.Now;
DateTime nz=Convert.ToDateTime("2015-4-2 17:30");
while (true)
{
a = a.AddMinutes(1);
if (nz.ToShortTimeString().Equals(a.ToShortTimeString()))
{
Console.WriteLine(a + "起床啦!");
Console.Write("是否关闭闹钟?Y/N");
string s = Console.ReadLine();
if (s=="y.ToUpper()")
{
break;
}
else
{
nz = nz.AddMinutes(5);
}
}
}
}
时间: 2024-10-24 07:13:43