Saturday, 23 March 2019

CPP-EX52

wap using class to cal simple interest amt use  default  value for rate

#include<iostream.h>
#include<conio.h>
class interest
{
    public:
    int p,t,rate;
    float si;
    void calc(int    rate=2)
    {
    cout<<"\n enter the principal and period";
        cin>>p>>t;
            si=(p*rate*t)/100;
        cout<<"\n simple interest is \n"<<si;
    }
};
void main()
{
    clrscr();
    interest i;
    i.calc();
    getch();
}