Here I am writing quick and simple learn way for C++.

Functions

Using functions we can structure our programs in a more modular way,

type name ( parameter1, parameter2, ...) { statements }

eg:

// add function example
#include <iostream>


using namespace std;

int add (int a, int b)
{
  int c;
  c=a+b;
  return (c);
}

int main ()
{
  int result;
  result = add (2,3);
  cout << "The result is " << result ;
  system("PAUSE");
  return EXIT_SUCCESS;

}

0

Add a comment

I am
I am
Archives
Total Pageviews
Total Pageviews
2 0 5 7 7 0 6
Categories
Categories
Loading