Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 SQRT HELP
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
notleetprogrammer




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sat Jun 10, 2006 3:04 pm   Post subject: (No 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)
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
notleetprogrammer




PostPosted: Sat Jun 10, 2006 3:25 pm   Post subject: (No subject)

thnx man
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: