click below
click below
Normal Size Small Size show me how
Structured prograing
Vocabulary Chapters 7-10
| Term | Definition |
|---|---|
| object | A collection of related data that comes with a set of functions thatoperate on it. The objects we have used so far are the cout object provided by the system, and strings. |
| index | A variable or value used to select one of the members of an ordered set, like a character from a string. |
| traverse | To iterate through all the elements of a set performing a similar operation on each. |
| counter | A variable used to count something, usually initialized to zero and then incremented. |
| loop | A statement that executes repeatedly while a condition is true or until some condition is satisfied. |
| infinite loop | A loop whose condition is always true. |
| body | The statements inside the loop. |
| iteration | One pass through (execution of) the body of the loop, including the evaluation of the condition. |
| tab | A special character, written as \t in C++, that causes the cursor to move to the next tab stop on the current line. |
| encapsulate | To divide a large complex program into components (like func-tions) and isolate the components from each other (for example, by usinglocal variables). |
| local variable | A variable that is declared inside a function and that existsonly within that function. Local variables cannot be accessed from outsidetheir home function, and do not interfere with any other functions. |
| generalize | To replace something unnecessarily specific (like a constant value) with something appropriately general (like a variable or parameter). Generalization makes code more versatile, more likelyto be reused, and some- times even easier to write. |
| development plan | A process for developing a program. |
| return value | The value provided as the result of a function call. |
| dead code | Part of a program that can never be executed, often because it appears after a return statement. |
| scaffolding | Code that is used during program development but is not part of the final version. |
| void | A special return type that indicates a void function; that is, one that does not return a value. |
| overloading | Having more than one function with the same name but different parameters. When you call an overloaded function, C++ knows which version to use by looking at the arguments you provide. |
| boolean | A value or variable that can take on one of two states, often called true and false. In C++, boolean values can be stored in a variable type called bool. |
| flag | A variable (usually type bool) that records a condition or status information. |
| comparison operator | An operator that compares two values and produces a boolean that indicates the relationship between the operands. |
| logical operator | An operator that combines boolean values in order to testccompound conditions. |
| structure | A collection of data grouped together and treated as a single object. |
| instance variable | One of the named pieces of data that make up a structure. |
| reference | A value that indicates or refers to a variable or structure. In a state diagram, a reference appears as an arrow. |
| pass by value | A method of parameter-passing in which the value provided as an argument is copied into the corresponding parameter, but the parameter and the argument occupy distinct locations. |
| pass by reference | A method of parameter-passing in which the parameter is a reference to the argument variable. Changes to the parameter also affect the argument variable. |
| increment | Increase the value of a variable by one. The increment operator in C++ is ++. In fact, that’s why C++ is called C++, because it is meant to be one better than C. |
| decrement | Decrease the value of a variable by one. The decrement operatorin C++ is-- |
| concatenate | To join two operands end-to-end. |
| modulus | An operator that works on integers and yields the remainder when one number is divided by another. In C++ it is denoted with a percent sign (%). |
| conditional | A block of statements that may or may not be executed depending on some condition. |
| chaining | A way of joining several conditional statements in sequence. |
| nesting | Putting a conditional statement inside one or both branches of another conditional statement. |
| recursion | The process of calling the same function you are currently executing. |
| infinite recursion | A function that calls itself recursively without every reach-ing the base case. Eventually an infinite recursion will cause a run-time error. |
| instance | An example from a category. My cat is an instance of the category “feline things.” Every object is an instance of some type. |
| instance variable | One of the named data items that make up an structure. Each structure has its own copy of the instance variables for its type. |
| constant reference parameter | A parameter that is passed by reference but that cannot be modified. |
| pure function | A function whose result depends only on its parameters, and that has so effects other than returning a value. |
| functional programming style | A style of program design in which the majority of functions are pure. |
| modifier | A function that changes one or more of the objects it receives as parameters, and usually returns void. |
| fill-in function | A function that takes an “empty” object as a parameter and fills it its instance variables instead of generating a return value. |
| algorithm | A set of instructions for solving a class of problems by a mechanical,unintelligent process. |
| vector | A named collection of values, where all the values have the same type, and each value is identified by an index. |
| element | One of the values in a vector. The [] operator selects elements of a vector. |
| index | An integer variable or value used to indicate an element of a vector.constructor |
| deterministic | A program that does the same thing every time it is run. |
| pseudorandom | A sequence of numbers that appear to be random, but which are actually the product of a deterministic computation. |
| seed | A value used to initialize a random number sequence. Using the same seed should yield the same sequence of values. |
| bottom-up design | A method of program development that starts by writing small, useful functions and then assembling them into larger solutions. |
| histogram | A vector of integers where each integer counts the number of values that fall into a certain range. |