Использование ЭВМ при обучении математикиРефераты >> Математика >> Использование ЭВМ при обучении математики
rmp:
REM вывод на экран меню с темами
baz$ = "prog.dat"
baz$ = parh$ + baz$
dlin = 30
GOSUB menu
finalshow:
OPEN "bat.bat" FOR OUTPUT AS #1
FOR i = 1 TO LEN(rez2$)
IF MID$(rez2$, i, 1) = "." THEN rash$ = MID$(rez2$, i + 1, 3)
NEXT i
PRINT #1, "@echo off "
IF rash$ = "bas" THEN PRINT #1, "@qbasic.exe /run "; rez2$
IF rash$ = "com" OR rash$ = "exe" OR rash$ = "bat" THEN PRINT #1, rez2$
PRINT #1, "@del bat.bat"
CLOSE #1
CLS
SYSTEM
reklama:
OPEN FILEHLP$ FOR INPUT AS #1
S = 0
DO
ON ERROR GOTO 0
LINE INPUT #1, stran$
S = S + 1
LOOP UNTIL EOF(1)
CLOSE #1
IF FIX(S / 18) >= (S / 18) THEN KS = FIX(S / 18) ELSE KS = FIX(S / 18) + 1
DIM stran$(S)
OPEN FILEHLP$ FOR INPUT AS #1
FOR i = 1 TO S
ON ERROR GOTO 0
LINE INPUT #1, stran$(i)
NEXT i
CLOSE #1
NS = 1
GOSUB stran
obrabotka:
A$ = INKEY$
IF A$ = CHR$(0) + CHR$(73) THEN NS = NS - 1: GOSUB stran
IF A$ = CHR$(0) + CHR$(81) THEN NS = NS + 1: GOSUB stran
IF A$ = CHR$(27) THEN ERASE stran$: RETURN
GOTO obrabotka
stran:
IF NS < 1 THEN NS = 1: RETURN
IF NS > KS THEN NS = KS: RETURN
n = 18 * NS
'SLC:
LOCATE 1, 1
PRINT "г"; STRING$(64, "="); "T=============¬"
PRINT "¦"; STRING$(15, " "); : COLOR 15, 0: PRINT "ИНФОРМАЦИОННО - СПРАВОЧНАЯ СИСТЕМА"; : COLOR 7, 0: PRINT STRING$(15, " ");
IF NS < 10 THEN PRINT "¦ Страница "; NS; "¦" ELSE PRINT "¦ Страница"; NS; "¦"
PRINT "¦"; STRING$(64, " "); "L=============¦"
FOR i = n - 17 TO n
IF i > S THEN PRINT "¦"; STRING$(78, " "); "¦" ELSE PRINT "¦ "; stran$(i); STRING$((76 - LEN(stran$(i))), " "); "¦"
NEXT i
PRINT "L"; STRING$(78, "="); "-"
COLOR 1, 7: PRINT " Выход - Esc ";
IF NS = 1 THEN COLOR 8, 7 ELSE COLOR 1, 7
PRINT " Предыдущая страница - PageUp ";
IF NS = KS THEN COLOR 8, 7 ELSE COLOR 1, 7
PRINT " Следующая страница - PageDown "
COLOR 7, 0
RETURN
menu:
COLOR 7, 0
CLS
OPEN baz$ FOR INPUT AS #2
DIM mas$(150, 2)
INPUT #2, R$
i = 0
DO
i = i + 1
INPUT #2, mas$(i, 1)
INPUT #2, mas$(i, 2)
LOOP UNTIL EOF(2)
CLOSE #2
m = i
IF m > 10 THEN m = 10
R = INT((25 - m) / 2)
nashalo:
u = 1: cur = 1: cur1 = 1
uold = LEN(R$): uold = dlin - uold: uuold = INT(uold / 2): uuuold = uold - uuold
R1$ = STRING$(uuuold, "=") + R$ + STRING$(uuold, "=") ' Формирование заголовка таблицы
tablisha:
LOCATE R, 1
PRINT STRING$(21, " "); "г"; R1$; "¬"
PRINT STRING$(21, " "); "¦"; STRING$(dlin, " "); "¦"
schet = 0
FOR t = u TO u + m - 1
schet = schet + 1
COLOR 7, 0: PRINT STRING$(21, " "); "¦";
IF cur1 = schet THEN COLOR 0, 7
' установка стандартной длинны фразы
uold = LEN(mas$(t, 1)): uold = dlin - uold: uuold = INT(uold / 2): uuuold = uold - uuold
t$ = STRING$(uuuold, " ") + mas$(t, 1) + STRING$(uuold, " ")
PRINT t$;
COLOR 7, 0: PRINT "¦"
NEXT t
PRINT STRING$(21, " "); "L"; STRING$(dlin, "="); "-"
GOSUB smotr
chetire:
kbd$ = INKEY$
flag = 0
SELECT CASE kbd$
CASE CHR$(0) + "H": cur = cur - 1: cur1 = cur1 - 1: flag = 1
CASE CHR$(0) + "P": cur = cur + 1: cur1 = cur1 + 1: flag = 1
CASE CHR$(0) + CHR$(61): GOTO dopoln
CASE CHR$(13): GOTO final
CASE CHR$(27): CLS : SYSTEM
END SELECT
IF flag = 0 THEN GOTO chetire
IF cur = 0 THEN u = i - m + 1: cur = i: cur1 = m: GOTO tablisha
IF cur = i + 1 THEN GOTO nashalo
IF cur1 = 0 THEN u = u - 1: cur1 = 1
IF cur1 = m + 1 THEN : u = u + 1: cur1 = m
GOTO tablisha
smotr:
LOCATE 1, 1: COLOR 15, 3: PRINT STRING$(80, " ")
ddl = (80 - LEN(mas$(cur, 2))) / 2
LOCATE 1, 1: COLOR 15, 3: PRINT STRING$(ddl, " "); mas$(cur, 2)
COLOR 7, 0
RETURN
final:
rez1$ = mas$(cur, 1)
rez2$ = mas$(cur, 2)
ERASE mas$
RETURN
dopoln:
CLS
LOCATE 10, 20: COLOR 7, 0: PRINT "Добавление новой темы в меню"
LOCATE 12, 10: COLOR 7, 0: PRINT "Для отмены нажмите <Esc> или <F3> для продолжения"
mmm:
kbd$ = INKEY$
SELECT CASE kbd$
CASE CHR$(0) + CHR$(61): GOSUB pop
CASE CHR$(27): CLS : GOTO rmp
END SELECT
GOTO mmm
pop:
CLS
LOCATE 10, 10: COLOR 7, 0
PRINT "Введите название новой темы"
LOCATE 12, 10
PRINT "Введите имя файла"
COLOR 0, 7
LOCATE 10, 40: PRINT STRING$(31, " ")
LOCATE 12, 40: PRINT STRING$(31, " ")
LOCATE 10, 40: INPUT "", a1$
LOCATE 12, 40: INPUT "", a2$
ERASE mas$
CLS
OPEN baz$ FOR APPEND AS #1
PRINT #1, a1$
PRINT #1, a2$
CLOSE #1
GOTO rmp
Приложение №2
Файл - vector1.bas
REM СУММА ВЕКТОРОВ
'Константы
speed = 800 'Скорость
FILEHLP$ = "vector.hlp"
filerez$ = "vector.rez"
oshibka = 0 'Общее количество ошибок
k = 10 'Длина пера вектора
k1 = 3 'Ширина пера вектора