midka228

Given two integers a and b – sides of triangle. You need to write a function that calculates the hypotenuse
of the triangle.
Do you know the Pythagorean theorem? Is it assumed that the triangle is right angled?
sqrt() is in <cmath>
and if its not a right triangle, sin, cos, etc are also in cmath -- they work in radians.
exponents can be done via pow(), but here, its better to just say a*a or b*b
you can look at the reference on this site for what else is lurking in cmath header.


Topic archived. No new replies allowed.