hello, I recently just got some of the understanding of call-by-reference values. Now im trying to use a call-by-value and cannot get it to work for my life. I know im doing something wrong but how wrong is the problem. Ive read on it for an hour and half, hopefully someone can help me. the call-by-value im using is calcSqFt. im trying to set it and then call it in the main.
Any help would be useful, thanks guys :)
I was trying to call the calcSqFt, i had the values width, height, and length in there because they are not identified inthe void, which is one of the issues im having.
the code runs correctly, but the value of sqft is 0 when outputted. also, should i have my ints and doubles inside my main and keep the constants outside the main?
and the return isnt setup correctly i dont think.
You should have all those variables in your main function never use globals. Also I'm not sure why you have sqft as a parameter. You should pass length , height , and width as parameters and do something like
1 2 3 4
int clacSqFt( constint height , constint length , constint width ) //all 3 are ints so it should reutrn int
{
return( ( 2 * length * height ) + ( 2 * width * height ) + ( width * height ) );
}