Computer Science Canada

SQRT HELP

Author:  notleetprogrammer [ Sat Jun 10, 2006 2:54 pm ]
Post subject:  SQRT HELP

WHY WONT THIS LET ME SQRT.....WOOOOOOOW
code:
var angle, side1, side2, hyp, answer : real
var side, name : string
put "Enter the side name..."
get name
if name = "hyp" then
    put "Enter hyp value."
    get hyp
end if
put "Enter side value..."
get side1
put "Enter second side value..."
get side2
if name = "hyp" then
    answer := hyp ** 2 - side1 ** 2
    sqrt(answer)
    put answer

end if

Author:  Dan [ Sat Jun 10, 2006 3:04 pm ]
Post subject: 

the sqrt function returns a value and dose not chage the value passed to it.

Quote:

sqrt ( r : real ) : real


So if you whont to put the sqrt of answer in answer you have to do:

code:

answer := sqrt(answer)

Author:  notleetprogrammer [ Sat Jun 10, 2006 3:25 pm ]
Post subject: 

thnx man


: