Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0025/triang.bas
There are 2 other files named triang.bas in the archive. Click here to see a list.
00100	PRINT
00105	PRINT "THIS PROGRAM FINDS THE UNKNOWN FEATURES OF ANY"
00110	PRINT "TRIANGLE, GIVEN ONE SIDE AND ANY TWO OTHER PARTS."
00115	PRINT
00120	PRINT
00125	PRINT "WHAT WILL BE GIVEN (1=SSS, 2=SAS, 3=SSA, 4=ASA, 5=AAS)";
00130	INPUT N
00135	PRINT
00140	LET R8=0
00145	LET R9=0
00150	IF (N-1)*(N-2)*(N-3)*(N-4)*(N-5)=0 THEN 165
00155	PRINT "ANSWER 1, 2, 3, 4, OR 5 PLEASE...."
00160	GOTO 120
00165	IF N=1 THEN 200
00170	PRINT "(NOTE: SPECIFY ANGLES AS 'DEG, MIN.DEC')"
00175	PRINT
00180	IF N=2 THEN 220
00185	IF N=3 THEN 360
00190	IF N=4 THEN 255
00195	IF N=5 THEN 315
00200	PRINT "WHAT ARE SIDE1, SIDE2, SIDE3";
00205	INPUT S(1),S(2),S(3)
00210	GOSUB 495
00215	GOTO 585
00220	PRINT "WHAT ARE SIDE1, ANG,LE3, SIDE2";
00225	INPUT S(1),A(3),B(3),S(2)
00230	LET I=3
00235	GOSUB 575
00240	LET S(3)=SQR(S(1)^2+S(2)^2-2*S(1)*S(2)*COS(R(3)))
00245	GOSUB 495
00250	GOTO 585
00255	PRINT "WHAT ARE ANG,LE1, SIDE3, ANG,LE2";
00260	INPUT A(1),B(1),S(3),A(2),B(2)
00265	FOR I=1 TO 2
00270	GOSUB 575
00275	NEXT I
00280	LET R(3)=3.1415926-R(1)-R(2)
00285	LET I=3
00290	GOSUB 530
00295	FOR I=1 TO 2
00300	GOSUB 485
00305	NEXT I
00310	GOTO 585
00315	PRINT "WHAT ARE ANG,LE3, ANG,LE1, SIDE3";
00320	INPUT A(3),B(3),A(1),B(1),S(3)
00325	FOR I=1 TO 3 STEP 2
00330	GOSUB 575
00335	NEXT I
00340	LET R(2)=3.1415926-R(1)-R(3)
00345	LET I=2
00350	GOSUB 530
00355	GOTO 295
00360	PRINT "WHAT ARE SIDE1, SIDE3, ANG,LE1";
00365	INPUT S(1),S(3),A(1),B(1)
00370	LET R8=1
00375	LET I=1
00380	GOSUB 575
00385	LET T=(S(3)*SIN(R(1)))/S(1)
00390	IF T-1>0.0000001 THEN 470
00400	IF 1-T>0.00000001 THEN 415
00405	LET R(3)=1.5707963
00410	GOTO 420
00415	LET R(3)=ATN(T/SQR(1-T^2))
00420	LET R(2)=3.1415926-R(1)-R(3)
00425	LET I=2
00430	GOSUB 485
00435	FOR I=2 TO 3
00440	GOSUB 530
00445	NEXT I
00450	IF R9=1 THEN 465
00451	IF S(3)>S(1) THEN 455
00452	GO TO 463
00455	PRINT
00460	PRINT "ONE SOLUTION IS:"
00462	GO TO 465
00463	LET R8=0
00465	GOTO 585
00470	PRINT
00475	PRINT "NO SOLUTION POSSIBLE...."
00480	GOTO 750
00485	LET S(I)=(S(3)/SIN(R(3)))*SIN(R(I))
00490	RETURN
00495	LET P=(S(1)+S(2)+S(3))/2
00500	LET R=SQR(((P-S(1))*(P-S(2))*(P-S(3)))/P)
00505	FOR I=1 TO 3
00510	LET R(I)=2*ATN(R/(P-S(I)))
00515	GOSUB 530
00520	NEXT I
00525	RETURN
00530	LET X1=57.297795*R(I)
00535	LET A(I)=INT(X1)
00540	LET B(I)=60*(X1-A(I))
00545	IF ABS(60-B(I))>0.00005 THEN 560
00550	LET B(I)=0
00555	LET A(I)=A(I)+1
00560	IF ABS(B(I))>0.0001 THEN 570
00565	LET B(I)=0
00570	RETURN
00575	LET R(I)=(A(I)+B(I)/60)/57.297795
00580	RETURN
00585	GOSUB 495
00590	LET W=R*P
00595	LET R1=S(1)/(2*SIN(R(1)))
00600	LET H(1)=S(3)*SIN(R(2))
00605	LET H(2)=S(1)*SIN(R(3))
00610	LET H(3)=S(2)*SIN(R(1))
00615	PRINT
00620	IF R9=1 THEN 640
00625	PRINT
00630	PRINT " ","   1","   2","   3"
00635	PRINT " ","-------","-------","-------"
00640	PRINT
00645	PRINT "SIDE",S(1),S(2),S(3)
00650	PRINT
00655	PRINT "ANGLE (RAD)",R(1),R(2),R(3)
00660	PRINT
00665	PRINT "ANGLE (DEG)",A(1),A(2),A(3)
00670	PRINT "      (MIN)",B(1),B(2),B(3)
00675	PRINT
00680	PRINT "ALT TO SIDE",H(1),H(2),H(3)
00685	PRINT
00690	PRINT
00695	PRINT "RADIUS OF CIRCUMSCR CIRCLE = ";R1
00700	PRINT "RADIUS OF INSCRIBED CIRCLE = ";R
00705	PRINT "          AREA OF TRIANGLE = ";W
00710	PRINT
00715	IF R9=1 THEN 750
00720	IF R8=0 THEN 750
00725	PRINT
00730	PRINT "A SECOND SOLUTION IS:"
00735	LET R9=1
00740	LET R(3)=3.1415926-R(3)
00745	GOTO 420
00750	PRINT
00755	PRINT
00760	PRINT "ANOTHER CASE (1=YES)";
00765	INPUT Q
00770	IF Q=1 THEN 115
00775	END