this is the code i've been trying to get compiled,but i have no clue how to fix my errors. i only understand basic concepts such as structure (where to but scaffolding, functions, etc...), but i don't know what the compiler is saying that i did wrong. here's my code:
#include <iostream>
#include <cmath>
using namespace std;
void showIntro();
//This procedure displays the following introduction text on the user's screen.
double percentageToFraction(double growthRate);
//This function takes in a percentage and converts it to a fractional value.
double calculateWACC(double DebtToValueRatio);
//This function calculates and returns the Weighted Average Cost of Capital based on the given Debt-to-Value ratio.
void calculatePVhorizonPeriod(double WeightedAverageCostCapital, double growthRate, double & valueOfHorizonPeriod);
//This procedure calculates the present value of the horizon period using the given weighted average cost of capital. the result is stored in the final arguement.
void calculatePVforecastPeriod(double WeightedAverageCostCapital, double & valueOfForecastPeriod);
//This procedure calculates the present value of the forecast period using the given weighted average cost of capital. The result is stored as the final argument.
double calculateValueOfBusiness(double valueOfForecastPeriod, double valueOfHorizonPeriod);
//This function takes the present value of the forecast and horizon periods as inputs, and returns their sum as a total value of business.
int main()
{
showIntro();
double growthRate, DebtToValueRatio;
cout << "enter growth rate (between 0 and 3)" << endl;
cin >> growthRate;
cout << "enter debt to value ratio (between 0 and 1)" << endl;
cin >> DebtToValueRatio;
i was actually able to get the errors all worked out and have moved on and added new sections of code that are giving me problems, but not nearly as much. could anyone perhaps tell me what i'm supposed to do about these errors?:
caen-vnc05% g++ project2.cpp -o project2 -s
project2.cpp: In function \u2018int main()\u2019:
project2.cpp:59: error: invalid initialization of non-const reference of type \u2018double&\u2019 from a temporary of type \u2018double*\u2019
project2.cpp:23: error: in passing argument 6 of \u2018void calculateSensitivity(double, double, double, double, double, double&, double&, double&)\u2019
and here is the code:
#include <iostream>
#include <cmath>
using namespace std;
void showIntro();
//This procedure displays the following introduction text on the user\u2019s screen.
double percentageToFraction(double growthRate);
//This function takes in a percentage and converts it to a fractional value.
double calculateWACC(double DebtToValueRatio);
//This function calculates and returns the Weighted Average Cost of Capital based on the given Debt-to-Value ratio.
void calculatePVhorizonPeriod(double WeightedAverageCostCapital, double growthRate, double & valueOfHorizonPeriod);
//This procedure calculates the present value of the horizon period using the given weighted average cost of capital. the result is stored in the final arguement.
void calculatePVforecastPeriod(double WeightedAverageCostCapital, double & valueOfForecastPeriod);
//This procedure calculates the present value of the forecast period using the given weighted average cost of capital. The result is stored as the final argument.
double calculateValueOfBusiness(double valueOfForecastPeriod, double valueOfHorizonPeriod);
//This function takes the present value of the forecast and horizon periods as inputs, and returns their sum as a total value of business.
void calculateSensitivity(double FirmValue, double WeightedAverageCostCapital, double valueOfHorizonPeriod, double valueOfForecastPeriod, double growthRate, double & Sensitivity5, double & Sensitivity10, double & Sensitivity20);
//This procedure calculates three sensitive values, given inputs for the firm value, weighted average cost of capital, original input growth rate, and the present value of the horizon and forecast periods. The last three arguments store the results for 5, 10, and 20 basis points, respectively.