|
直角三角形ABCにおいて
C/A=SIN(θ)
B/A=COS(θ)とする
A/(A+B+C),B/(A+B+C),C/(A+B+C)を求める
(A)/(A+B+C)→(A/A)/(A/A+B/A+C/A)→1/(1+COS(θ)+SIN(θ))
DIM A$(3),B$(3)
FOR I=1 TO 3
READ A$(I),B$(I)
NEXT I
DATA "A","A+B+C"
DATA "B","A+B+C"
DATA "C","A+B+C"
PRINT REPEAT$(" ",8);
FOR I=1 TO 3
PRINT "(";A$(I);")/(";B$(I);")";REPEAT$(" ",12);
NEXT I
PRINT
FOR TH=0 TO 360
PRINT TH;"° ";
FOR I=1 TO 3
CALL CALC(A$(I),B$(I),RAD(TH))
NEXT I
PRINT
NEXT TH
END
EXTERNAL SUB CALC(A$,B$,TH)
WHEN EXCEPTION IN
LET K$=STR$(CALCSUB(A$,TH)/CALCSUB(B$,TH))
PRINT LEFT$(K$ & REPEAT$(" ",23),23);
USE
PRINT " ERROR!! ";
END WHEN
END SUB
EXTERNAL FUNCTION CALCSUB(E$,TH)
SELECT CASE UCASE$(E$)
CASE "A"
LET CALCSUB=1
CASE "B"
LET CALCSUB=COS(TH)
CASE "C"
LET CALCSUB=SIN(TH)
CASE "A+B"
LET CALCSUB=1+COS(TH)
CASE "A+C"
LET CALCSUB=1+SIN(TH)
CASE "B+C"
LET CALCSUB=SIN(TH)+COS(TH)
CASE "A+B+C"
LET CALCSUB=1+SIN(TH)+COS(TH)
END SELECT
END FUNCTION
|
|