11. List the similarities and differences between how you invoke (call) a predefined (that is, library) function and a user-defined function.
■ FUNCTIONS THAT RETURN A BOOLEAN VALUE
The returned type for a function can be the type
bool. A call to such a function returnsone of the values
true or
false and can be used anywhere that a Boolean expression is
allowed. For example, it can be used in a Boolean expression to control an
if-elsestatement or to control a loop statement. This can often make a program easier to read.
By means of a function declaration, you can associate a complex Boolean expression
with a meaningful name. For example, the statement
if (((rate >= 10) && (rate < 20)) || (rate == 0)){...}can be made to read
if (appropriate(rate))provided that the following function has been defined:
bool appropriate(int rate) return (((rate >= 10) && (rate < 20)) || (rate == 0));Self-Test Exercises
Bạn đang xem 11. - ABSOLUTE C PHẦN 3 PPS