write a programe to calculate the simple intrest and compund
intrest using by function overlading



write a programe to calculate the simple intrest and compund intrest using by function overlading..

Answer / Rashmi Chaudhary

Here's an example of how you can implement simple interest and compound interest functions with function overloading in C++:

```cpp
#include <iostream>
using namespace std;

double simple_interest(double principal, double rate, int years) {
return principal * rate * years;
}

double compound_interest(double principal, double rate, int years, int times) {
return principal * pow((1 + (rate / times)), (times * years));
}

int main() {
cout << "Simple Interest: " << simple_interest(1000, 0.05, 3) << endl;
cout << "Compound Interest (annual): " << compound_interest(1000, 0.05, 3, 1) << endl;
cout << "Compound Interest (quarterly): " << compound_interest(1000, 0.05, 3, 4) << endl;
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

what is the 3 types of system development life cycle

1 Answers  


What is the important feature of inheritance?

1 Answers   BPL,


Name an advantage of linked list over array?

11 Answers   IBM, Infosys,


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1 Answers  


which is best institute to learn c,c++ in ameerpet hyderabad

1 Answers  


I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...

1 Answers  


What is object in oop with example?

1 Answers  


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

3 Answers  


What is cohesion in oop?

1 Answers  


swapping program does not use third variable

5 Answers   TCS,


i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????

3 Answers   Infosys,


What is an orthogonal base class?

2 Answers  


Categories