Использование ЭВМ при обучении математикиРефераты >> Математика >> Использование ЭВМ при обучении математики
glupo:
glupo = glupo + 1
FOR clor = 15 TO 0 STEP -1
PLAY "n60l20"
COLOR clor
LOCATE 16, 53: PRINT "ОШИБКА! ПОВТОРИТЕ ВВОД"
NEXT clor
COLOR ccc
RETURN
Приложение №4
Файл - vector3.rez
REM УМНОЖЕНИЕ ВЕКТОРА НА ЧИСЛО
'Константы
speed = 800 'Скорость
FILEHLP$ = "vector.hlp"
filerez$ = "vector.rez"
oshibka = 0 'Общее количество ошибок
k = 10 'Длина пера вектора
k1 = 3 'Ширина пера вектора
radius = 2 'Радиус начала вектора
zakr = 1 'Закраска начала вектора
zakrstr = 1 'Закраска стрелки вектора
c = 12 'Цвет стрелки - курсора
curx = 0: cury = 0 'Установка начальниых координат положения стрелки
DIM colora(10)
DIM slovo$(5)
DIM zapusk$(18)
SCREEN 9, , 0, 0
OPEN filerez$ FOR APPEND AS #3
PRINT #3, DATE$; " СТАРТ ПРОГРАММЫ < УМНОЖЕНИЕ ВЕКТОРА НА ЧИСЛО > - "; TIME$;
GOSUB coord 'Построение координатной плоскости
GOSUB zapusk 'Страничка с заданиями
FOR shag = 1 TO 10
PRINT #3, : PRINT #3, "Задание - "; shag
glupo = 0
GOSUB coord 'Построение координатной плоскости
p = 1: GOSUB slov
ccc = 10
GOSUB telo
abx = curx - curoldx: aby = cury - curoldy
er: 'Задание числа er
RANDOMIZE TIMER
er = INT(RND(1) * 19) - 9
IF ABS(er * abx) > 20 OR ABS(er * aby) > 22 THEN GOTO er
PRINT #3, "AB("; abx; ","; aby; ")"; TAB(15); "Загадано число "; er
GOSUB analis
NEXT shag
GOSUB coord
LOCATE 10, 53: PRINT "Вы допустили "; oshibka; " ошибок"
PRINT #3,
PRINT #3, "Количество допущенных ошибок - "; oshibka
PRINT #3,
CLOSE #3
DO WHILE INKEY$ = "": LOOP
GOTO alis
telo:
GOSUB preobr:
GOSUB zapomin ' Запоминает
GOSUB strelka ' Рисует стрелку
GOSUB vibor '
GOSUB oldstrelka ' Закрашивает место, где была стрелка
IF fl = 2 THEN fl = 0: RETURN
GOTO telo
vibor:
flag = 0
kbd$ = INKEY$
SELECT CASE kbd$
CASE CHR$(0) + "H": IF cury < 10 THEN cury = cury + 1: flag = 1
CASE CHR$(0) + "P": IF cury > -10 THEN cury = cury - 1: flag = 1
CASE CHR$(0) + "K": IF curx > -11 THEN curx = curx - 1: flag = 1
CASE CHR$(0) + "M": IF curx < 11 THEN curx = curx + 1: flag = 1
CASE CHR$(0) + CHR$(59): GOSUB reklama
CASE CHR$(32): GOSUB final: IF fl = 2 THEN RETURN
CASE CHR$(27): GOSUB vihod
END SELECT
IF flag = 0 THEN GOTO vibor
kx = x: ky = y
GOSUB preobr
RETURN
strelka:
'==== x y c ============ Рисует стрелку ========
PSET (x, y), c
DRAW "r6g2f4g2h4g2u6"
PAINT (x + 1, y + 1), c
PSET (x, y), 15
DRAW "r6g2f4g2"
RETURN
zapomin:
'==== x y ============ zap(9,9) ========
DIM zap(9, 9)
FOR i = 1 TO 9
FOR j = 1 TO 9
zap(i, j) = POINT(i + x - 1, j + y - 1)
NEXT j
NEXT i
RETURN
oldstrelka:
'==== kx ky zap(9,9) ==== Рисует ====
FOR i = 1 TO 9
FOR j = 1 TO 9
PSET (i + kx - 1, j + ky - 1), zap(i, j)
NEXT j
NEXT i
ERASE zap
RETURN
preobr:
x = curx * 16 + 203
y = 160 - cury * 14
RETURN
final:
kx = x: ky = y: GOSUB oldstrelka
IF fl = 1 THEN x2 = x: y2 = y: GOSUB strvect: IF ccc = 10 THEN p = 2: GOSUB slov ELSE p = 5: GOSUB slov
IF fl = 0 THEN curoldx = curx: curoldy = cury: x1 = x: y1 = y: CIRCLE (x, y), radius, ccc: IF zakr = 1 THEN PAINT (x, y), ccc
IF ccc = 10 AND fl = 0 THEN p = 3: GOSUB slov
'IF ccc = 13 AND fl = 0 THEN p = 4: GOSUB slov
'IF ccc = 14 AND fl = 0 THEN p = 6: GOSUB slov
fl = fl + 1
GOSUB zapomin: GOSUB strelka: RETURN
coord:
COLOR 15: CLS
'LINE (0, 0)-(639, 349), 15, B
LINE (10, 10)-(395, 311), 15, B
LINE (10, 10)-(394, 310), 7, B
LINE (400, 10)-(629, 311), 15, B
LINE (400, 10)-(628, 310), 7, B
FOR g = 27 TO 380 STEP 16
LINE (g, 15)-(g, 305), 8, B
NEXT g
FOR g = 20 TO 300 STEP 14
LINE (19, g)-(387, g), 8, B
NEXT g
FOR g = -10 TO 10 STEP 2
LOCATE 13, g * 2 + 25
IF g <> 0 THEN PRINT g
NEXT g
FOR g = -10 TO 10 STEP 2
LOCATE 12 - g, 24
PRINT g
NEXT g
LINE (19, 160)-(387, 160), 7, B
LINE (384, 158)-(387, 160), 7
LINE (384, 162)-(387, 160), 7
LINE (203, 15)-(203, 305), 7, B
LINE (200, 18)-(203, 15), 7
LINE (206, 18)-(203, 15), 7
LOCATE 2, 28
PRINT "y"
LOCATE 11, 49
PRINT "x"
shar:
FOR c = 1 TO 10
CIRCLE (405 + c * 20, 41), 7, 15
LINE (405 + c * 20, 38)-(410 + c * 20, 31), 15
PAINT (405 + c * 20, 39), colora(c), 15
NEXT c
RETURN
strvect:
dx = SQR((x2 - x1) ^ 2)
dy = SQR((y2 - y1) ^ 2)
df = SQR((dx * dx) + (dy * dy))
IF df = 0 THEN df = 1
dsx = k * dx / df
dsy = k * dy / df
dxx = k1 * dy / df
dyy = k1 * dx / df
IF x1 < x2 THEN x3 = x2 - dsx: x4 = x2 - dsx / 2 ELSE x3 = x2 + dsx: x4 = x2 + dsx / 2
IF y1 < y2 THEN y3 = y2 - dsy: y4 = y2 - dsy / 2 ELSE y3 = y2 + dsy: y4 = y2 + dsy / 2
IF SGN(x1 - x2) = SGN(y1 - y2) THEN x31 = x3 - dxx: y31 = y3 + dyy: x32 = x3 + dxx: y32 = y3 - dyy
IF SGN(x1 - x2) * (-1) = SGN(y1 - y2) THEN x31 = x3 + dxx: y31 = y3 + dyy: x32 = x3 - dxx: y32 = y3 - dyy
IF SGN(x1 - x2) = 0 OR SGN(y1 - y2) = 0 THEN x31 = x3 - dxx: y31 = y3 - dyy: x32 = x3 + dxx: y32 = y3 + dyy
LINE (x31, y31)-(x2, y2), ccc
LINE (x32, y32)-(x2, y2), ccc
IF zakrstr = 1 THEN LINE (x32, y32)-(x31, y31), ccc: PAINT (x4, y4), ccc
LINE (x1, y1)-(x2, y2), ccc
RETURN
reklama:
SCREEN 9, , 1, 1