< previous page page_326 next page >

Page 326
Main                                                                                                               Level 0
Print two lines of asterisks
Print Welcome Home!
Print four lines of asterisks

Print 2 Lines                                                                                                    Level 1
Print ***************
Print ***************

Print 4 Lines
Print ***************
Print ***************
Print ***************
Print ***************

If we write the two Level 1 modules as void functions, the main function is simply
int main()
{
    Print2Lines();
    cout << Welcome Home! << endl;
    Print4Lines();
    return 0;
}
Notice how similar this code is to the main module of our top-down design. It contains two function callsone to a function named Print2Lines and another to a function named Print4Lines. Both of these functions are parameterlessthat is, they have no parameters within the parentheses.
The following code should look familiar to you, but look carefully at the function heading.

 
< previous page page_326 next page >