Hi, I'm having trouble passing a value from one function to another.
However, I am supposed to pass the calculated grossSalary from the function getGrossSalary over to getNetSalary.
I've tried to use static variables and change the return values unsuccessfully. Appreciate the time and help.
I would do it like this, you're calling your function getGrossSalary from getNetSalary.
Otherwise you could declare a new double variable in your main function and save your first calcution to it like double grossS = getGrossSalary(hoursWorked, payRate);. This variable can be given to your next function.
The main point, no matter where you call the function, is that you store the value returned by a function into a variable that you can use (multiple times):
1 2 3 4 5
snafu = getGrossSalary(hoursWorked, payRate);
// use snafu:
std::cout << snafu;
auto fubar = getNetSalary( snafu, tax );
std::cout << fubar;