using System;namespace test8sw
{
class FallThrough {
static void Main(string[] args)
{
if (args.Length != 1) return;
int nMonth = Int32.Parse(args[0]);
if (nMonth < 1 ¦¦ nMonth > 12>) return; int nDays = 0;
switch (nMonth) {
case 2: nDays = 28; break;
case 4:
case 6:
case 9:
case 11: nDays = 30; break;
default: nDays = 31;
}
Console.WriteLine("{0} days in this month",nDays);
}
}
}
if (nMonth < 1 ¦¦ nMonth > 12>) return;
这句有问题应如何改法呢?请各位哥哥姐姐们帮帮忙!谢谢!
{
class FallThrough {
static void Main(string[] args)
{
if (args.Length != 1) return;
int nMonth = Int32.Parse(args[0]);
if (nMonth < 1 ¦¦ nMonth > 12>) return; int nDays = 0;
switch (nMonth) {
case 2: nDays = 28; break;
case 4:
case 6:
case 9:
case 11: nDays = 30; break;
default: nDays = 31;
}
Console.WriteLine("{0} days in this month",nDays);
}
}
}
if (nMonth < 1 ¦¦ nMonth > 12>) return;
这句有问题应如何改法呢?请各位哥哥姐姐们帮帮忙!谢谢!
{
static void Main(string[] args)
{
if (args.Length != 1) return;
int nMonth = Int32.Parse(args[0]);
if ((nMonth < 1)&( nMonth > 12)) return; int nDays = 0;
switch (nMonth)
{
case 2: nDays = 28; break;
case 4:
case 6:
case 9:
case 11: nDays = 30; break;
default: nDays = 31; break;
}
Console.WriteLine("{0} days in this month",nDays);
}
}