My professor has given an assignment where the objective is to learn how to call a function. The assignment is a program that calculates the future value of a savings account. We are supposed to create a function that calculates the interest value based on inputs from the user. I have created a program that calls a function, but I can't seem to get the function to return anything at all. I'm having trouble assigning a value to variables in the function, and I do not know how to take values inputted by the user in the int main() function and use them in the function that I have created. My professor asked that we introduce the function with a prototype above the int main() function, and put the actual commands for the function below the main. Here is what i have so far, how can I 1. get the function to return anything. 2. use variables inputted by the user in the main in my function, 3. assign values to the variables in the function. Thanks
Code:#include <iostream> using namespace std; double futureinvestmentvalue (double initialdeposit, double monthlyinterestrate, int years); int main () { double initialdeposit, monthlyinterestrate; int years; cout <<"This program calculates the future balance of your savings account.\n"; cout <<"Please input the amount of the initial deposit into the account: "; cin >>initialdeposit; cout <<"Please input the annual interest rate of the account: "; cin >>monthlyinterestrate; cout <<"Please input the amount of time in years the account will be active: "; cin >>years; cout<<"The final balance of the account is " <<futureinvestmentvalue<< endl; return 0; } double futureinvestmentvalue (double initialdeposit, double monthlyinterestrate, int years){ return 0; } /* ----program output----- This program calculates the future balance of your savings account. Please input the amount of the initial deposit into the account: 5 Please input the annual interest rate of the account: 5 Please input the amount of time in years the account will be active: 5 The final balance of the account is 008F11AE Press any key to continue . . . --------------------------*/