Guest_imported
New member
- Jan 1, 1970
- 0
Hi, I have a quick question. I am trying to use a function in a calculation. I have a function called "Calc_Formula()" and it returns the sum of two numbers. In a seperate .cc file I try to call the function as followed.
#include "formula.h" // formula.cc is location of my Calc_Formula() function formula.h holds the class for formula
int Tots()
{
double first = 0.0;
double second = 0.0; // two seperate variables to
break up calculation
// Problem occuring below with the formula::Calc_Formula()
first = (25 + formula::Calc_Formula());
second = (25 - formula::Calc_Formula());
return (first / second);
}
can someone show me why this is incorrect? I get an error for some reason. I am just not sure how to use a function that returns a value. Thanks
#include "formula.h" // formula.cc is location of my Calc_Formula() function formula.h holds the class for formula
int Tots()
{
double first = 0.0;
double second = 0.0; // two seperate variables to
break up calculation
// Problem occuring below with the formula::Calc_Formula()
first = (25 + formula::Calc_Formula());
second = (25 - formula::Calc_Formula());
return (first / second);
}
can someone show me why this is incorrect? I get an error for some reason. I am just not sure how to use a function that returns a value. Thanks