51Testing软件测试论坛
标题:
关于Switch语句的环形复杂度
[打印本页]
作者:
guitarmanxzq
时间:
2008-11-12 22:24
标题:
关于Switch语句的环形复杂度
请问以下代码的环形复杂度为多少?MSDN上说是4,但不知道如何算出来的?请教各位
public void Method(DayOfWeek day)
{
switch (day)
{
case DayOfWeek.Monday:
Console.WriteLine("Today is Monday!");
break;
case DayOfWeek.Tuesday:
Console.WriteLine("Today is Tuesday!");
break;
case DayOfWeek.Wednesday:
Console.WriteLine("Today is Wednesday!");
break;
case DayOfWeek.Thursday:
Console.WriteLine("Today is Thursday!");
break;
case DayOfWeek.Friday:
Console.WriteLine("Today is Friday!");
break;
case DayOfWeek.Saturday:
Console.WriteLine("Today is Saturday!");
break;
case DayOfWeek.Sunday:
Console.WriteLine("Today is Sunday!");
break;
}
}
}
复制代码
作者:
guitarmanxzq
时间:
2008-11-12 22:28
希望高人都指点一二......
作者:
Lemon_s
时间:
2008-11-13 10:16
不应该是7吗?
忘记了,忘记了...
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2