write a c++ program to find out compound interest using inside and outside the class
Answers
Answer:
++ Program To Calculate Simple Interest using class */
#include<iostream>
using namespace std;
class bank
{
private:
float p;
float r;
float t;
float si;
float amount;
public:
void read ( )
{
cout <<" Enter Principle Amount :: ";
cin>>p ;
cout<<"\n Enter Rate of Interest :: ";
cin>>r;
cout <<"\n Enter Number of years :: ";
cin>>t;
si= (p *r*t) /100;
amount = si + p;
}
void show( )
{
cout<<"\n Entered Details are :: \n";
cout<<"\n Principle Amount: "<<p;
cout <<"\n\n Rate of Interest: "<<r;
cout <<"\n\n Number of years: "<<t;
cout <<"\n\n Interest : "<<si;
cout <<"\n\n Total Amount : "<<amount<<"\n";
}
};
;
int main ()
{
bank b ;
b.read ( );
b.show ( );
return 0;
}
output
Enter Principle Amount :: 385000
Enter Rate of Interest :: 13.89
Enter Number of years :: 4
Entered Details are ::
Principle Amount: 385000
Rate of Interest: 13.89
Number of years: 4
Interest : 213906
Total Amount : 598906
Process returned 0
pls mark me brainliest and follow me
hope it helps you