Greetings,

I am suffering a loss of sanity at the hands of this issue. I think i have something worked out, however, could someone shed some light and keep me sane?

Problem Description

It would be of interest to others if you could write a program that would allow other people to enter 3 sizes and for the program to identify the type of triangle, the perimeter and whether is is right angled or not. It would also be advantageous to be able to work out additional sides if only two can be entered.


My Attempt at Triangle Identification

Dim A as integer
Dim B as integer
Dim C as integer

'A & B are the shorter sides, whilst C is the longer side. This will be made apparent on the form.

IF A=B and B=C and A=C then; 
[INDENT]textbox1.text("Equilateral")[/INDENT];
Elseif A=B and B(Does not equal)C and A(does not equal)C then; 
[INDENT]textbox1.text("Isosceles")[/INDENT];
Elseif A(does not equal)B and B(does not equal)C and A(does not equal)C then; 
[INDENT]textbox1.text("Scalar")[/INDENT];
else;
[INDENT]textbox1.text("Not a triangle")[/INDENT]

Working out additional sides

I know the formula for working out the hypotoneuse, it's Pythagoras' Theorem:

a^2 + b^2 = c^2
(The ^ symbolises to the power for this case)

I also know that inorder to recreate this i need to use the math.pow function, i'm just not sure how to apply it.

And to find the hypotoneuse you need to take the square root of C^2 which requires use of the

math.root

function. I believe that also needs to be defined like:

Dim Root as single

As for finding a shorter side, it is the same theorem, except it is tweaked slightly.

Something Else

I also wish to know which item i should use which allows me to type in something like:

textbox3.text = textbox1.text + textbox2.text

where the value contained in these text boxes are added.

Did this make sense to anyone? Can anyone help?

It would be very much appreciated.

Kindest Regards

Myk

Ps - I apologise if i haven't managed the Code parts correctly, i am relatively new to posting my code.

<> is not equal to

Unless I am going senile there are no circumstances where three lengths cannot make a triangle.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.