end() in c++ in java code example

Example 1: C++ and endl

// endl example
#include <iostream>     // std::cout, std::end
using namespace std;
int main () {

  int a=100;
  double b=3.14;

  cout << a;
  cout << endl;              // manipulator inserted alone
  cout << b << endl << a*b;  // manipulator in concatenated insertion
  endl (cout);               // endl called as a regular function

  return 0;
}

Example 2: how to end a c++ program early

void func( bool d )
{
    if( ! ( d ) )
        return;

    //Load of code here that you don't want to execute if the above is incorrect.
}

Tags:

Cpp Example