I have never created my own program before (I'm in college right now), and I have to create a program for the length c on any triangle using sides a, b, and theta angle c. Here is what I have so far (however wrong it may be!).
Function C(A, B, theta)
C = (A ^ 2 + B ^ 2 - 2 * A * B * theta) ^ (1 / 2)
theta = Acos * (180 / Pi)
Pi = 4 * Acos
End Function
It doesn't have to be complex. I just have to get it to work on a triangle. There are no other requirements. Thanks for your time!
first of all when you want to create a function your should start with e.g:
private function c (a,b,theta) as long
meaning:
function c
variables to come with the function are a,b, and theta
you should call this function with Answer=c(1,2,3)
aCos does not exist in VB, you should use Atn
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
look for 'Derived Math Functions' in VB-help
^(1/2) won't work, use Sqr instead.
C = (A ^ 2 + B ^ 2 - 2 * A * B * theta) ^ (1 / 2)
c=sqr(a*a + b*b - 2*a*b*theta)
remember that VB works in radians rather than degrees.
e.g:
Answer=C(2,3,0.45)
Function C(A, B, theta)
C =SQR (A *A + B *B - 2 * A * B * theta)
End Function
Answer=2.7568......