This code shows how to use default argument in function
or how to create an optional parameter to the function
*/
#include
void div(int a,int b=1)
{
float c;
cout<
cout<
c= float(a)/b;
cout<
}
int main(void)
{
int i=10,j=2;
cout<
div(i,j);
div(i);
return 0;
}
/* Here Second parameter of div() function is
optional we can ommit it autometically consider
as Default argument value as 1*/


1 comment:
Very good start dear........
Keep ahead...
Post a Comment