HOME

Sunday, November 29, 2015

DYNAMIC INITILIZATION OF OBJECT INCLUDING CONSTRUCTOR

#include<iostream>
using namespace std;
class simple
{
    int p,t,r;
public:
    simple(int x, int y, int z)
    {
        p=x;
        t=y;
        r=z;
    }
    void display()
    {
        int result=(p*t*r)/100;
        cout<<"SIMPLE INTEREST IS "<<result<<endl;
    }
};
int main()
{
    int x,y,z;
    cout<<"ENTER PRINCIPLE, TIME AND RATE "<<endl;
    cin>>x>>y>>z;
    simple s1(x,y,z);
    s1.display();
    return 0;

}

No comments:

Post a Comment