What is default arguments in cpp
What is default arguments in cpp
PROGRAM:
#include<iostream> using namespace std; class interest{ float p,r,n; public: void setdata( ){ cout<<"\n P: "; cin>>p; cout<<" R: "; cin>>r; cout<<" N: "; cin>>n; calc(p,n,r); calc(p,n);//!uses default arguments } float calc(float p,float n,float r=0.25){ //!default argument cout<<"\n\t\t\t Interset is : "<<(p*r*n); } }; int main(){ interest i; i.setdata(); return 0; }
Comments
Post a Comment