The keyword false is a predefined value, representing the result of a conditional expression whose condition is not satisfied. For example, in the conditional expression x < y, if x is not less than y, the result of the expression will be false. Also see bool.
A fencepost error is a logical error that causes a loop to be executed one more or one less time than the correct count. A common cause of this error is confusing the number of elements in a vector or array with the index of the last element. The derivation of this term is by analogy with the problem of calculating the number of fence sections and fence posts that you need for a given fence. For example, if you have to put up a fence 100 feet long, and each section of the fence is 10 feet long, how many sections of fence do you need? Obviously, the answer is 10. Now, how many fenceposts do you need? 11. The confusion caused by counting fenceposts when you should be counting segments of the fence (and vice-versa) is the cause of a fencepost error. To return to a programming example; if you have a vector with 11 elements, the index of the last element is 10, not 11. Thus, confusing the number of elements with the highest index has much the same effect as the fencepost problem. This sort of problem is also known, less colorfully, as an off-by-one error.
A float is a type of floating-point variable that can represent a range of positive and negative numbers of magnitude from approximately 1.401298e-45 to approximately 3.40282e+38 (and 0), with approximately 6 digits of precision.
A floating-point variable is a C++ approximation of a mathematical "real number". Unlike mathematical real numbers, C++ floating-point variables have a limited range and precision, depending on their types; see the individual types float and double for details.
A for statement is a loop control statement that causes its controlled block to be executed while a specified logical expression (the continuation expression) is true. It also provides for a starting expression to be executed before the first execution of the controlled statement, and a modification expression to be executed after every execution of the controlled statement. For example, in the for statement for (i = 0; i < 10; i ++), the initialization expression is i = 0, the continuation expression is i < 10, and the modification expression is i ++.
The keyword friend allows access by a specified class or function to private members of a particular class.
A function is a section of code having a name, optional arguments, and a return type. The name makes it possible for one function to start execution of another one via a function call; the arguments are used to provide input for the function, and the return type allows the function to provide output to its calling function when the return statement causes the calling function to resume execution.
A function call (or call for short) causes execution to be transferred temporarily from the current function (the calling function) to the one named in the function call (the called function). Normally, when a called function is finished with its task, it will return to the calling function, which will pick up execution at the statement after the function call.
A function declaration tells the compiler some vital statistics of the function: its name, its arguments, and its return type. Before we can use a function, the compiler must have already seen its function declaration. The most common way to arrange for this is to use a #include statement to insert the function declaration from the header file where it exists into our source code module.
Function header; see function declaration.
Function overloading is the C++ facility that allows us to create more than one function with the same name. So long as all such functions have different signatures, we can write as many of them as we wish, and the compiler will be able to figure out which one we mean.