Hey guys so I need to come up with an equation in my C++ program that calculates the hypotenuse of a right triangle but we cannot use the math library so no "cmath".
1 2 3 4 5 6 7
double HypoTriangle(float sideA, float sideB)
{
double sideC = sqrt(sideA*sideA + sideB*sideB);
return sideC;
ode you need help with here.
That is what I had BEFORE knowledge of this came from my professor, any suggestions?
Ok so I'm a little overwhelmed not going to lie but I also read at some point that you can do by multiply by .01? I don't know the accuracy of this and this does not compile but it was something I was trying to mess with....
1 2 3 4 5 6 7 8 9 10 11 12 13 14
double HypoTriangle(float sideA, float sideB)
{
int sides = (sideA*sideA + sideB*sideB);
double n = 0.01;
while ((n * n) < sides)
{
n += 0.01;
}
return triResult;
}