Pages

Thursday, 22 February 2018

Defining and Calling a Function in C++ Programming Language


Defining and Calling a Function in C++ Programming Language

  #include  <iostream>
  using namespace std;
  void starline();         // prototype  the function
  int main()
  {
       starline( );      // function  call
       cout<< "\t\tBjarne Stroustrup\n";
       starline( );    // function call
       return 0;
  }

  // function definition
    void starline()
  {
       int  count;         // declaring a LOCAL  variable
       for(count = 1; count <=65; count++)
            cout<<  "*";
       cout<<endl;
  }