Cpp - C++ program with several functions

Introduction

The following code create three functions including main() function

Demo

/*A program with some functions and comments */ 

#include <iostream> 
using namespace std; 

void line(), message();             // Prototypes 

int main() //from   ww  w  . java2 s . c  o m
{ 
    cout << "Hello! The program starts in main()." 
         << endl; 
    line(); 
    message(); 
    line(); 
    cout << "At the end of main()." << endl; 

    return 0; 
} 

void line()                       // To draw a line. 
{ 
    cout << "--------------------------------" << endl; 
} 

void message()               // To display a message. 
{ 
    cout << "In function message()." << endl; 
}

Result

Related Topic