Assume you need to test a function named max. The function max receives two int arguments and returns the larger. Write the definition of driver function testmax whose job it is to determine whether max is correct. So testmax returns true if max is correct and returns false otherwise.
.
.
Click on the title for the solution
.
.
bool testmax()
{
if (max(1,2) == 2 && max(2,1) == 2 && max(1,1)==1)
return true;
else
return false;
}
.
Click on the title for the solution
.
.
This is the answer:
:
bool testmax()
{
if (max(1,2) == 2 && max(2,1) == 2 && max(1,1)==1)
return true;
else
return false;
}
Comments
Post a Comment