Top-Down Design with Functions 1.
Develop your program solutions from existing information. Use the system
documentation derived from applying the software development method as the
initial framework for the program. ■ Edit the data
requirements to obtain the main function declarations. ■
Use the refined algorithm as the starting point for the executable statements
in the main function. 2. If a new problem is an extension of a previous one,
modify the previous program rather than starting from scratch. 3. Use C’s
library functions to simplify mathematical computations through the reuse of
code that has already been written and tested. Write a function call
(consisting of the function name and arguments) to activate a library function.
After the function executes, the function result is substituted for the
function call. 4. Use a structure chart to show subordinate relationships
between subproblems. 5. Utilize modular programming by writing separate
function subprograms to implement the different subproblems in a structure
chart. Ideally, your main function will consist of a sequence of function call
statements that activate the function subprograms. 6. You can write functions
without arguments and results to display a list of instructions to a program
user or to draw a diagram on the screen. Use a function call consisting of the
function name followed by an empty pair of parentheses () to activate such a
function. 7. Write functions that have input arguments and that return a single
result to perform computations similar to those performed by library functions.
When you call such a function, each actual argument value is assigned to its
corresponding formal parameter. 8. Place prototypes (similar to function
headings) for each function subprogram before the main function, and place the
function definitions after the main function in a source file. Use (void) to
indicate that a function has no parameters.
Tidak ada komentar:
Posting Komentar