Complete listing of Functions02.cpp
/*File: Functions02.cpp This C++ program illustrates functions having no parameters and no return value. This program displays the following text on the screen: Hello World Goodbye cruel world ************************************************/ #include <iostream> using namespace std; //A function prototype is required due to the // placement of the goodbye function relative // to the main function. The main function // requires the prototype in order to understand // the interface to the goodbye function, which // has not yet been defined when it is called. void goodbye();//function prototype //No function prototype is required for the // hello function because it is defined before it // is called. void hello(){ cout << "Hello World" << endl; }//end hello //---------------------------------------------// int main(){//Global main function. hello(); goodbye(); return 0; }//end main function //---------------------------------------------// void goodbye(){ cout << "Goodbye cruel world" << endl; }//end goodbye Listing 2 |