Chapter 6 Flashcards
(30 cards)
What does the power function look like?
pow(2.0, 3.0) = 2^3 = 8 Raises a (first) number to a (second) power.
Of what type is the power function?
Double
What does the square root function look like?
sqrt(4) = 2
Takes the square root of a function
Of what type is the square root function?
Double
What does the floor function?
This function calculates the largest whole number that is less than or equal to X.
floor(48.79) = 48.0 (Or it rounds down)
Of what type is the floor function?
Double
What libraries do all functions need to use?
include
What are the two categories of user-defined functions?
Value returning functions and Void functions
What is a value returning function?
Functions that have a return type. These functions return the value of a certain data type using the return statement.
What is a void function?
Functions that do not have a return type. These functions do not use a return statement to return a value.
What are the three ways to use value returning functions?
- Save for further calculation.
- Use the value in some calculation.
- Print the value.
What is suggested about the value returning statement?
The returning function is used in an assignment statement as the parameter in a function call, and in an output statement.
What are the first 4 properties that form the function header?
- The names of the function
- The number of parameters is any
- The data type of each parameter
- The data type of the value returned by the function.
What is the 5th property of the function called?
The body.
What is the body?
the code within the function needed to do the task.
What are these five properties called together?
Definition of the function
A variable declared in the function heading is called?
Formal parameter
A variable or expression listed in a function call?
Actual parameter
What is the syntax of a value-returning function?
functionType functionName(formal parameter list) { Statements or code; }
What is another name for function type?
Data type.
What is the syntax to call a value-returning function?
functionName (actual paramenter list)
What is a value returning function called?
An expression?
What is the syntax of the return statement?
return expression;
In C++ return is a reserved word true or false?
True