问答题

[说明] 计算下列源代码的McCabe环数,画出控制流程图并用罗马数字标出区域。
read x,y,z;
type =“scalene”;
if (x= =y or x = = z or y= = z)type =“isosceles ”;
if (x = = y and x = = z) type =“equilateral”;
if (x>= y+ z Or y>= x+20rz>=x+ y) type= “not a triangle”;
if (x<=0 or y<= 0 or z <=0) type =“bad inputs”;
print type;

【参考答案】

试题四
[解答要点] McCabe 的环数是软件开发中继代码行之后最常使用的度量。它基于图论的环数。 McCabe......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)