A C++ program with several functions : Basics « Function « C++






A C++ program with several functions

A C++ program with several functions

#include <iostream>
using namespace std;
void line(), message();
int main()
{
   cout << "The program starts in main()." << endl;
   line();
   message();
   line();
   cout << "At the end of main()." << endl;
   return 0;
}
void line()
{
   cout << "line();" << endl;
}
void message()
{
   cout << "In function message()." << endl;
} 

           
       








Related examples in the same category

1.Class as a return typeClass as a return type
2.Another example of a conversion functionAnother example of a conversion function
3.Computes the factorial of an integer iteratively: a loop, and recursively
4.Throwing an exception from a functionThrowing an exception from a function