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.

Respuesta :

CPED

Answer:

bool testmax()                               // function definition

{  

//demonstrating working of the function max

if (max(1,2) == 2 && max(2,1) == 2 && max(1,1)==1)    

return true;                                  // true if the max functions correctly

else  

return false;                                //false for wrong functioning of max

}

Explanation:

Driver function:

A driver function is the one which demonstrates the code of library-style and solves problem. If a code contains some class A, driver functions would be functions that are in your code just to show that class A behaves as expected.