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 |
what is the 3 types of system development life cycle
What is the important feature of inheritance?
Name an advantage of linked list over array?
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.
which is best institute to learn c,c++ in ameerpet hyderabad
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...
What is object in oop with example?
Why is it so that we can have virtual constructors but we cannot have virtual destructors?
What is cohesion in oop?
swapping program does not use third variable
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??????
What is an orthogonal base class?