Program to calculate simple interest by using the concept of objects and classes.

#include
#include
class sint
{
private:
float p,r,t,si;
public:
void dataentry();
void calc()
{
si=p*r*t/100;
};
void display();
};
void sint::display()
{
cout<<"nPrincipletRatetTimetInterest";
cout<<"n"<<p<<"tt"<<r<<"t"<<t<<"t"<<si;
};

void sint::dataentry()
{
clrscr();
cout<>p;
cout<>r;
cout<>t;
};
main()
{
class sint a;
a.dataentry();
a.calc();
a.display();
getch();
}

Leave a reply