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

Username:   Password: 
 RegisterRegister   
 Cosine inverse?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
not_l33t




PostPosted: Thu May 20, 2004 6:12 pm   Post subject: Cosine inverse?

Is it possible to do a cos-1 in Turing. I need it for a program that I am creating for finding the degrees of angle and telling if its a right angle triangle or not. I am simply going to use the elseif and else commands. So can you guys help me with the cosine.
Sponsor
Sponsor
Sponsor
sponsor
Pickles




PostPosted: Thu May 20, 2004 6:26 pm   Post subject: ...

isnt that 1/cos ?
not_l33t




PostPosted: Thu May 20, 2004 6:28 pm   Post subject: Re: ...

Pickles wrote:
isnt that 1/cos ?


That don't work.
AsianSensation




PostPosted: Thu May 20, 2004 6:31 pm   Post subject: (No subject)

arccosd or arccos, depending on whether you want it in radian or degree form.
not_l33t




PostPosted: Thu May 20, 2004 6:32 pm   Post subject: (No subject)

AsianSensation wrote:
arccosd or arccos, depending on whether you want it in radian or degree form.


Dude you're my hero. Very Happy
not_l33t




PostPosted: Thu May 20, 2004 6:59 pm   Post subject: (No subject)

Quote:
var a, b, c : real
var x1, x2, x3, y1, y2, y3, t1, t2, t3 : real
var u1, u2, u3, i1, i2, i3 : real
put "Enter the length of the first side of the triangle."
get a
put "Enter the length of the second side of the triangle."
get b
put "Enter the length of the third side of the triangle."
get c

x1 := -2 * (b) * (c)
x2 := -2 * (a) * (c)
x3 := -2 * (a) * (b)

y1 := b ** 2 + c ** 2
y2 := a ** 2 + c ** 2
y3 := a ** 2 + b ** 2

t1 := a ** 2 - y1
t2 := b ** 2 - y2
t3 := c ** 2 - y3

u1 := t1 / x1
u2 := t2 / x2
u3 := t3 / x3

i1 := arccosd (u1)

i2 := arccosd (u2)

i3 := arccosd (u3)


put "First angle is: ", i1
put "Second angle is: ", i2
put "Third angle is: ", i3



Anyone in TDSB taking Grade 10 TIK will be thanking me a lot. Very Happy
not_l33t




PostPosted: Thu May 20, 2004 7:54 pm   Post subject: (No subject)

code:
var a, b, c : real
var x1, x2, x3, y1, y2, y3, t1, t2, t3 : real
var u1, u2, u3, i1, i2, i3 : real

put "Enter the length of side 'a' of the triangle."
    get a
    put "Enter the length of side 'b' of the triangle."
    get b
    put "Enter the length of side 'c' of the triangle."
    get c

    x1 := -2 * (b) * (c)
    x2 := -2 * (a) * (c)
    x3 := -2 * (a) * (b)

    y1 := b ** 2 + c ** 2
    y2 := a ** 2 + c ** 2
    y3 := a ** 2 + b ** 2

    t1 := a ** 2 - y1
    t2 := b ** 2 - y2
    t3 := c ** 2 - y3

    u1 := t1 / x1
    u2 := t2 / x2
    u3 := t3 / x3

    i1 := arccosd (u1)

    i2 := arccosd (u2)

    i3 := arccosd (u3)
    put skip

    const z7:= 90   
   
    if i1 = z7 then
    put "This is a right angle triangle."
   end if
   
   if i2 = z7 then
   put "This is a right angle triangle."
   end if
   
   if i3 = z7 then
   put "This is a right angle triangle."
   end if
   
   
    put "Angle A is: ", i1
    put "Angle B is: ", i2
    put "Angle C is: ", i3

   




I am having problems exiting this program. I want the program to exit when one of the angle is 90 degrees.

Put these values in as they make a right angle triangle when it asks you when it runs: 1, 2, 1.732050808.
not_l33t




PostPosted: Thu May 20, 2004 10:11 pm   Post subject: (No subject)

Anyone?
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  [ 8 Posts ]
Jump to:   


Style:  
Search: