Wite a compare function that returns 1 if a gt b 0 if a


Write a compare function that returns 1 if a > b , 0 if a == b , and -1 if a < b . The user must be prompted for the values of a and b. The compare function must have arguments for a and b.

To demonstrate your compare function, you must call the compare function three times, once for each condition, from within your program and display (using print statement) the return code of the function.

Use the following table for values of a and b to use when calling your compare function from within your program:

a

b

5

2

2

5

3

3

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Wite a compare function that returns 1 if a gt b 0 if a
Reference No:- TGS02223061

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)