source file name : default.cpp
#include<iostream.h>
#include<conio.h>
void printline(int cnt=80, char ch='*')
{
int n;
cout<<endl;
for(n=0;n<cnt;n++)
{
cout<<ch;//<<" ";
}
}
void simpint(long p,int n,float r=5.5f)
{
double si=(p*n*r)/100;
cout<<"\n simple interest is: "<<si;
}
int main()
{
clrscr();
cout<<" Function Default Arguments program\n ";
printline();// function calling with default arguments
simpint(10000,3,6.5f);// normal calling function
simpint(10000,3);// function calling with default arguments
printline(70,'#');
getch();
return 0;
}
output:
0 Comments
Post a Comment