My question is how to find out
how many values of the variable num
used to completely test all branches of the
following code?
if(num>0)
if(value<25)
{
value = 10*num;
if(num<12)
value=value/10;
}
else
value = 20*num;
else
value=30*num;
My question is how to find out
how many values of the variable num
used to completely test all branches of the
following code?
if(num>0)
if(value<25)
{
value = 10*num;
if(num<12)
value=value/10;
}
else
value = 20*num;
else
value=30*num;
poorman,
your code should be in the following style:
_________________________________
if(num>0)
{
if(value<25)
{
value = 10*num;
if(num<12)
value=value/10;
}
else
value = 20*num;
}
else
value=30*num;
_________________________________
how many values of the variable num
used to completely test all branches of the
following code?
u can find out the number of values by debugging both using the lang's debugger or manually (e.g dry run).
if u r using turbo c, then u can press F7 sequentially.
then put the cursor below the 'num' variable and press Alt+F4.
or u may use the menu bar.
try it yourself.
good luck.
thanx...
take care...
Jackie
So for num you would need 3 values.
num <= 0
num > 0 && num < 12
num > 0 && num >= 12
But you have not got all cases then since you didn't take variable value into account.