C++ Program to calculate interest amount using function overloading
IDE used - Codeblocks
techee INDIA |
techee INDIA |
#include<iostream>
#include<stdlib.h>
using namespace std;
void amount(float princ, int time, float rate)
{
cout<<"\nprincipal amount : "<<princ;
cout<<"\ntime : "<<time<<"years";
cout<<"\nrate : "<<rate;
cout<<"\ninterest amount : "<<(princ*time*rate);
}
void amount(float princ, int time)
{
cout<<"\nprincipal amount : "<<princ;
cout<<"\ntime : "<<time<<"years";
cout<<"\nrate : 0..08 ";
cout<<"\ninterest amount : "<<(princ*time*0.08);
}
void amoutn(float princ, float rate)
{
cout<<"\nprincipal amount : "<<princ;
cout<<"\ntime : 2 years ";
cout<<"\nrate : "<<rate;
cout<<"\ninterest amount : "<<(princ*2*rate);
}void amoutn(int time, float rate)
{
cout<<"\nprincipal amount : 2000 ";
cout<<"\ntime : "<<time<<"years";
cout<<"\nrate : "<<rate;
cout<<"\ninterest amount : "<<(2000*time*rate);
}
void amoutn(float princ)
{
cout<<"\nprincipal amount : "<<princ;
cout<<"\ntime : 2 years";
cout<<"\nrate : 0.08 ";
cout<<"\ninterest amount : "<<(princ*2*0.08);
}
int main()
{
system("cls");
cout<<"\ncase 1 ";
amount(2300.0f,3,0.11f);
cout<<"\ncase 2 ";
amount(2500.0f,3);
cout<<"\ncase 3 ";
amount(2,0.12f);
cout<<"\ncase 4 ";
amount(6,0.07f);
cout<<"\ncase 5 ";
amount(2,0.12f);
return 0;
}
Also check: - C++ program to calculate factorial of an integer with output
Output: -
techeeINDIA |
Jai hind
also check: - C++ Program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on user's choice with output
C++ Program to calculate interest amount using function overloading with output
Reviewed by mushrafkhan772
on
July 19, 2018
Rating:
No comments: