hi, i need some advise i have find the hypotenuse,passing three different ways,by value,pointer and reference. i know that c2=a2+b2 but i don't know how to start, any ideas will be aprreciated.
thanks
Printable View
hi, i need some advise i have find the hypotenuse,passing three different ways,by value,pointer and reference. i know that c2=a2+b2 but i don't know how to start, any ideas will be aprreciated.
thanks
well if you have to pass all three ways that means you're using functions....
You're probably going to use atleast one function for the calculations, what do you want that function to do? What would the decleration of that function be?
maybe something like this:
float calchypt(Pass the legs in here);
with it actaull being:
Take note that was just psudo code...some of the things like square root and squared you'll need from an include (I think it's math.h) and I'm not 100% sure on thte syntax there.Code:float calchypot(Pass atleast the legs in here)
{
float temp = leg1^2 + leg2^2;
hypot=sqrt(temp);
//now if you declared hypot in this function,
//then you'll want to return it here
}
Kermi3
that was fast, thanks,yes the psudo code is now <cmath>for c++.net, i'll fallow your example
it's always easier than it first looks, if your lucky...I've always found that I just have to lay it all out and look @ it.