Нарисовать треугольник в окружности- QBasic(Бейсик)

CLS
INPUT "Print the number of star ends (only odd [nechetnye] numbers starting from 5) "; L
CONST pi = 3.14159265#
CONST gr = pi / 180
'variables:
cx = 320
cy = 240
r = 200
'L= number of star ends from input
om = ((L + 1) / 2) - 1

DIM xn(720), yn(720)

FOR i = 0 TO 720
    xn(i) = cx - SIN(i * gr) * r
    yn(i) = cy - COS(i * gr) * r
NEXT i

SCREEN 12

FOR i = 0 TO 720
    PSET (xn(i), yn(i)), 2
NEXT

FOR i = 0 TO L
    LINE (xn(i * 360 / L), yn(i * 360 / L))-(xn((i + om) * 360 / L), yn((i + om) * 360 / L)), 3
NEXT

Тестирование выполнено в программе QB64 ( Скачать )

Leave a Comment