Painted on a new form, in the form of a called Text1 Commend1 text box and a name of a command button, click the command button, randomly generated three integers between 100-300, judge whether the three integers can form a triangle, if can't, to produce three integers between 100-300, until the three number can directly form a triangle, and then calculate the area of a triangle, and output the area of a triangle in the text box (keep two significant figures), at the same time draw the triangle on the form,
CodePudding user response:
How to determine whether three integer can constitute a triangle?
CodePudding user response:
reference 1st floor dsd999 response: how to determine whether three integer can form a triangle? Ha ha,,, the original poster said three integers may refers to the three integers corresponding line can form a triangle,, CodePudding user response:
refer to the second floor lsftest response: Quote: refer to 1st floor dsd999 response: How to determine whether three integer can constitute a triangle? Ha ha,,, the original poster said three integers may refers to the three integers corresponding line can form a triangle,, I understand your meaning, but the three integers can constitute a triangle have long forgotten, If the three number 100200300? CodePudding user response:
Three integer... Three coordinates are also similar, integer can do? CodePudding user response:
reference 4 floor WallesCai response: three integer... Three coordinates are also similar, integer can do? Three integer is the length of the triangle three sides are likely to form the triangle wow CodePudding user response:
reference 5 floor CityBird reply: Quote: refer to 4th floor WallesCai response: Three integer... Three coordinates are also similar, integer can do? Three integer is the length of the triangle three sides are likely to form the triangle wow If is three side, as long as the largest number is less than the rest of the sum of two Numbers can constitute a triangle. And then directly set of Helen formula can draw area. Junior middle school mathematics knowledge. CodePudding user response:
Seems to be: If (a + b & gt; C) Or (b + c & gt; A) Or (c + a & gt; B) Then S=(((a + b + c) * (a + b - c) * (b + c - a) * (c + a - b)) ^ 1/2)/4 End the If On both sides and a triangle were greater than the third, CodePudding user response:
Halo,,,, Triangle arbitrary on both sides must be greater than the sum of the third side,,, Triangle arbitrary on both sides must be smaller than the difference between the third side,,, CodePudding user response:
Another saying, is randomly generated three integers, and then judge can constitute a triangle, if you can, and then calculate the area of a triangle, with Helen formula: Set P=(a + b + c)/2 is: S=(P (P - a) (b) P (P - c)) ^ 0.5, a, b, c for triangle trilateral length. How to determine whether a triangle? Use a + b> C and a - b Then you can drawing, should be no requirement for graphics, so only need to draw any a trilateral side length for a, b, c of triangle line CodePudding user response:
Private Sub Command1_Click () Dim t Randomize Do T=Split (Int (200) 100 + Rnd * & amp; "" & amp; Int (200) 100 + Rnd * & amp; "" & amp; Int (200) 100 + Rnd *) Me. The Caption=Join (t,) ", " Loop Until area (Val (t (0)), Val (t (1)), Val (2)) (t)=True End Sub Private Sub Form_Load () Me. Scale (100, 400) - (400-100) End Sub The Function area (a, b, c) As a Boolean If (a + b & gt; C) And (b + c & gt; A) And (c + a & gt; B) Then Area=True Text1. Text=(((a + b + c) * (a + b - c) * (b + c - a) * (c + a - b)) ^ 1/2)/4 Dim cosb As Single Cosb=(a ^ 2 + c ^ 2 - b ^ 2)/(2 * a * c) Me. Cls Me. The Line (0, 0) - (b, 0), vbRed Me. The Line (0, 0) - (a * a * cosb, Sqr (1 - cosb ^ 2)), vbRed Me. The Line (b, 0) - (a * a * cosb, Sqr (1 - cosb ^ 2)), vbRed End the If End the Function