overloading binary operatorsclass sifloat


Overloading Binary Operators

class SI

{float i,p,n,r,a;

public:

SI(){};

SI(int gp,int gn, int gr);

void putdata(void);

SI operator+(SI);

};

SI SI::operator+(SI i1)

{SI i2; i2.p=p+i1.p; i2.i=i+i1.i; i2.a=a+i1.a; return i2;

}

void SI::putdata(void)

{cout<<"Principle is: "<

cout<<"Interest is "<

cout<<"Amount is "<

}

SI::SI(int gp,int gn, int gr)

{p=gp;n=gn;r=gr; i=(p*n*r)/100; a=p+i;

}

int main()

{           SI i1,i2,i3;

i1=SI(1000,2,10); i1.putdata(); cout<

return 0;

}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: overloading binary operatorsclass sifloat
Reference No:- TGS0161152

Expected delivery within 24 Hours