Image

Imagejavamdk wrote in Imagecpp

Hey guys... I'm working right now with functions and local variabls, which is kind of confusing me slightly.

I have 6 functions, omitting main... and I need another function to use the variables from the other function. I'm not catching on to this passing arguments.

For example:
double taxCalc(double sTax)
{  if (cState == "IN")
      sTax = dCost * .06
   else
      sTax = 0;
   return sTax;
}

double final(double final)
{  double tCost;
   tCost = dCost + sTax;
   return tCost;
}

I know my code is so messed up... but, like for taxCalc(double).. I need it to test from the other function to see if cState is equal. But I can't since it's not in the scope of the other function.

Also like, double final(double), I'm trying to get the dCost from another function and sTax... how do I do that?
I hope this somewhat makes sense.

I'm not asking to have this done for me, since I wouldn't learn anything anyway... but guidance would be great