Wednesday, 4 December 2013

Parameterized Function

#include <iostream>
using namespace std;
void addition (int a, int b)
{
  int r;
  r=a+b;
  cout <<"The result is" <<r;

}

int main ()
{
  int a,b;
  cout<<"Enter First Number"<<endl;
  cin>>a;
  cout<<"Enter Second Number"<<endl;
  cin>>b;
  addition(a,b);
 
}
In this program,We will discuss Parameterized Function
A Parameterized Function is the Function,which will recieve parameters from any  other function(Main is also a function).
we will enter two numbers and these two numbers will save in a and b(Type int),
then we will send these two numbers to addition function,which will add these two numbers and display there result.......!!
Note:-


As shown in figure,a will be send to x,b will be send to y and c will be send to z  respectively and in our case a will be send to a and b will be send to b...!!
The a and b,which we will sending from the main is the data type of main,and,a and b which is recieving these two are data types of addition function......!!

0 comments: