debuging code im xtremely new to C++ i dont undrstnd how 2 fix the errors it says i hav when i try to compile

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;

growthRate = percentageToFraction (growthRate);
double WeightedAverageCostCapital;
WeightedAverageCostCapital = calculateWACC(DebtToValueRatio);

calculatePVhorizonPeriod( WeightedAverageCostCapital, growthRate, & valueOfHorizonPeriod);

calculatePVforecastPeriod(WeightedAverageCostCapital, valueOfForecastPeriod);

calculateValueOfBusiness(valueOfForecastPeriod, valueOfHorizonPeriod);

return 0;
}

void showIntro()
{
cout << "Welcome to the CloudTools Valuation Tool" << endl;
cout << "Copyright Wolverines & Co. All Rights Reserved" << endl;
}
double percentageToFraction(double growthRate)
{
growthRate = growthRate/100;
return growthRate;
}

double calculateWACC(double DebtToValueRatio)
{
double WeightedAverageCostCapital;
WeightedAverageCostCapital = (DebtToValueRatio)*.06*(1-.35)+(DebtToValueRatio-1)*.11;
return WeightedAverageCostCapital;
}

void calculatePVhorizonPeriod(double WeightedAverageCostCapital,
double growthRate, double & valueOfHorizonPeriod)
{
valueOfHorizonPeriod = (1/(pow((1+calculateWACC),5)))*(20/(WeightedAverageCostCapital- growthRate));
}

void calculatePVforecastPeriod(double WeightedAverageCostCapital,
double & valueOfForecastPeriod)
{
double DebtToValueRatio;
calculateWACC(DebtToValueRatio);
valueOfForecastPeriod = (10/(1+WeightedAverageCostCapital))+(12/(pow(1+WeightedAverageCostCapital),2))+(14/(pow(1+WeightedAverageCostCapital),3))+(16/(pow(1+WeightedAverageCostCapital),4))+(18/(pow(1+WeightedAverageCostCapital),5));
}

double calculateValueOfBusiness(double valueOfForecastPeriod,
double valueOfHorizonPeriod)
{
double x;
x = valueOfForecastPeriod + valueOfHorizonPeriod;
return x;
}


What are the errors? And can you put the code in "[" "code" "]" "[" "/code]" blocks (without the quotes)?
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.

int main()
{

double growthRate, DebtToValueRatio;
double WeightedAverageCostCapital;
double valueOfHorizonPeriod;
double valueOfForecastPeriod;
double FirmValue;
double x;
double Sensitivity5;
double Sensitivity10;
double Sensitivity20;

showIntro();


cout << "enter growth rate (between 0 and 3)" << endl;
cin >> growthRate;
cout << "enter debt to value ratio (between 0 and 1)" << endl;
cin >> DebtToValueRatio;

growthRate = percentageToFraction (growthRate);

WeightedAverageCostCapital = calculateWACC(DebtToValueRatio);

calculatePVhorizonPeriod( WeightedAverageCostCapital, growthRate, valueOfHorizonPeriod);

calculatePVforecastPeriod(WeightedAverageCostCapital, valueOfForecastPeriod);

x = calculateValueOfBusiness(valueOfForecastPeriod, valueOfHorizonPeriod);

cout << "Firm is worth $" << x << " million" << endl;

calculateSensitivity( FirmValue, WeightedAverageCostCapital, valueOfHorizonPeriod, valueOfForecastPeriod, growthRate, & Sensitivity5, & Sensitivity10, & Sensitivity20);

FirmValue = Sensitivity5 - x;

cout << "Sensitivity5 = $" << FirmValue << " million" << endl;

return 0;
}

void showIntro()
{
cout << "Welcome to the CloudTools Valuation Tool" << endl;
cout << "Copyright Wolverines & Co. All Rights Reserved" << endl;
}
double percentageToFraction(double growthRate)
{
growthRate = growthRate/100;
return growthRate;
}

double calculateWACC(double DebtToValueRatio)
{
double WeightedAverageCostCapital;
WeightedAverageCostCapital = (DebtToValueRatio)*.06*(1-.35)+(1-DebtToValueRatio)*.11;
return WeightedAverageCostCapital;
}

void calculatePVhorizonPeriod(double WeightedAverageCostCapital,
double growthRate, double & valueOfHorizonPeriod)
{
valueOfHorizonPeriod = (1/(pow((1+WeightedAverageCostCapital),5)))*(20/(WeightedAverageCostCapital- growthRate));
}

void calculatePVforecastPeriod(double WeightedAverageCostCapital,double & valueOfForecastPeriod)
{

valueOfForecastPeriod = 10/((1+WeightedAverageCostCapital))+12/(pow((1+WeightedAverageCostCapital),2))+14/(pow((1+WeightedAverageCostCapital),3))+16/(pow((1+WeightedAverageCostCapital),4))+18/(pow((1+WeightedAverageCostCapital),5));
}

double calculateValueOfBusiness(double valueOfForecastPeriod,
double valueOfHorizonPeriod)
{
double x;
x = valueOfForecastPeriod + valueOfHorizonPeriod;
}

void calculateSensitivity(double FirmValue, double WeightedAverageCostCapital, double valueOfHorizonPeriod, double valueOfForecastPeriod, double growthRate, double & Sensitivity5, double & Sensitivity10, double & Sensitivity20)
{
Sensitivity5 = .05;
Sensitivity10 = .1;
Sensitivity20 = .2;

valueOfHorizonPeriod = (1/(pow((1+WeightedAverageCostCapital),5)))*(20/(WeightedAverageCostCapital- (growthRate+Sensitivity5)));

calculatePVhorizonPeriod( WeightedAverageCostCapital, growthRate, valueOfHorizonPeriod);

calculatePVforecastPeriod(WeightedAverageCostCapital, valueOfForecastPeriod);

Sensitivity5 = calculateValueOfBusiness(valueOfForecastPeriod, valueOfHorizonPeriod);

valueOfHorizonPeriod = (1/(pow((1+WeightedAverageCostCapital),5)))*(20/(WeightedAverageCostCapital- (growthRate+Sensitivity10)));

calculatePVhorizonPeriod( WeightedAverageCostCapital, growthRate, valueOfHorizonPeriod);

calculatePVforecastPeriod(WeightedAverageCostCapital, valueOfForecastPeriod);

Sensitivity10 = calculateValueOfBusiness(valueOfForecastPeriod, valueOfHorizonPeriod);

valueOfHorizonPeriod = (1/(pow((1+WeightedAverageCostCapital),5)))*(20/(WeightedAverageCostCapital- (growthRate+Sensitivity20)));

calculatePVhorizonPeriod( WeightedAverageCostCapital, growthRate, valueOfHorizonPeriod);

calculatePVforecastPeriod(WeightedAverageCostCapital, valueOfForecastPeriod);

Sensitivity20 = calculateValueOfBusiness(valueOfForecastPeriod, valueOfHorizonPeriod);
}
Can you please put your code within [code][/code]

It makes it much easy to read. So much so I haven't even bothered to look at your code yet to even try and figure out what you've done wrong.
Topic archived. No new replies allowed.