Вопрос

I have read an article with following example:

void func()
{
if (condition1)
a = a + 1;
if (condition2)
a = a - 1;
}

It says the CC is 3 as there are three possible paths. How come? Why not 4? I Would expect TRUE,TRUE; FALSE,FALSE; TRUE, FALSE and FALSE, TRUE.

Does not matter what the statements are. CC=Ifs-EndPoints+2. It is always 3 for 2 IFs and one ending..

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
scroll top