Monday, April 5, 2010

Module 5 - "Fun"ctions

1) What are the main differences between local and global variables?
2) Can a local variable be declared anywhere within a block?
3) Does a local variable hold its value between calls to the function in which it is declared?

Create a function called hypot( ) that computes the length of the hypotenuse of a right triangle given the lengths of the two opposing sides. Demonstrate its use in a program. For this problem, you will need to use the sqrt( ) standard library function, which returns the square root of its argument.

It has this prototype:
double sqrt(double val);
It uses the header cmath

No comments: