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;
}
Add a comment