Program for calculating Simple Interest using the concept of Default Arguments
//Program for Interest calculation using the concept of default arguments #include<iostream.h> #include<conio.h> void main() { float amount, principal; int time; float interest(float p, int n, float r=0.15); cout<<"Program for simple interest calculation"<<endl; cout<<"Please enter principal amount:"; cin>>principal; cout<<"Please enter Time: "; cin>>time; amount=interest(principal, time); cout<<"\nThe amount is:"<<amount; cout<<"\nPress any key to continue..."; getch(); } float interest(float p, int n,float r) { return (p+((p*r*n)/100.0)); }