for (int i =1;i<=3 ;i++ ) { if (i == 1) { Console.Write("你到底爱不爱我?"); } if (i == 2) { Console.Write("我问你呢,你到底爱不爱我?"); } if (i == 3) { Console.Write("你聋了么?我问你爱不爱我!!"); } string a = Console.ReadLine(); if (a == "爱") { Console.WriteLine("嗯,我也爱你。"); System.Threading.Thread.Sleep(2000); Console.WriteLine("从此王子和公主过上了没羞没臊的生活!"); break; } else { if (i == 3) { Console.WriteLine("滚!"); } } }
Console.Write(" 请输入年份:"); for (; ; ) { int a = int.Parse(Console.ReadLine()); if (a >= 0 && a <= 9999) { Console.Write("请输入月份:"); for (; ; ) { int b = int.Parse(Console.ReadLine()); if (b <= 12 && b > 0) { Console.Write("请输入日期:"); for (; ; ) { int c = int.Parse(Console.ReadLine()); if (c > 0 && c <= 31) { Console.WriteLine("你输入的格式" + a + "年," + b + "月," + c + "日,格式正确"); break; } else { Console.Write("你输入的日期错误,请从新输入:"); } } break; } else { Console.Write("你输入的月份错误,请重新输入:"); } } break; } else { Console.Write("你输入的年份错误,请重新输入:"); } }