BASIC 20 4 10 0 N88 Basic 1 0.0 N88 Basic..................................... 1 0.1............................................... 3 1 4 2 5 3 6 4 7 5 10 6 13 7 14 0 N88 Basic 0.0 N88 Basic 0.1: N88Basic N88Basic 0.1 N88 BASIC for Windows95N88 BASIC for Windows95 0.2 0.2: N88 BASIC 1
N88 BASIC 0.3 C: My Documents 0.6: 0.3: (R) (G) 0.7 0.7: enterreturn 0.8 0.4: (F) BA- SIC.bas 0.8: (V) 0.9: 0.5: 0.10 2
BASIC Windows 0.10: 0.14: Windows BASIC Windows N88 BASIC 0.11: 0.15: 0.12: (R) (H) N88BASIC 0.1 0.13: N88 BASIC 3
1 1.1 () a b a b 10 10 ex 1-1 20 input "a=";a a=?a 30 input "b=";b b=?b 40 c=a*b a b 50 print "a*b=";c a*b=60 60 end end print print a print "hello!!" print "a=";a a hello!! a=a input input a input "a=";a a a=?a 1.2 () a b a b read,data 10 ex 1-2 20 read a, b a b data 30 data 5, 2, a 5 b 2 40 c=a*b 50 print "a*b=";c 60 end read, data data read 4
read a, b, c, d data 5, 12, 50, -90 abcd data read a=5 : b=12 : c=50 : d=-90 1.1 () 1.2 () 2 ab θ(theta) c input c 2 = a 2 + b 2 2ab cos θa 2 a^2 a*a cos θ cos(theta*3.14159/180) x sqr(x) 2 2.1 () for next 1.1 10 10 ex 2-1 20 for n = 1 to 10 step 1 n 1 10 1 30-60 30 input "a=";a for next 40 input "b=";b 50 c=a*b 60 print"a*b=";c 70 next n n 10 20 80 end for next for next step OKfor next for n = 0 to 6 step 2 next i i 0 6 2 i 6 for 2.2 () if 1.1 10 5
10 ex 2-2 20 n=0 n 0 30 n=n+1 n 1 n 1 40 input "a=";a 50 input "b=";b 60 c=a*b 70 print "a*b=";c 80 if n<10 then 30 else 90 n<10 30 90 90 end if then else if then 30 else 60 30 60 2.1 () 2 1 2 3 15 2.2 () ax 2 + bx + c = 0 Kyosuu-kai!! 3 3.1 () 12 50, 92, 78, 32, 10, 60, 88, 36, 75, 62, 59, 99 6
10 ex 3-1 20 dim tokuten(12) tokuten 12 30 goukei = 0 0 40 for n = 1 to 12 12 50 read tokuten(n) data 1 60 print n, "tokuten";tokuten(n) 70 goukei = goukei + tokuten(n) 80 next n 90 heikin = goukei / 12 100 print "goukei=";goukei 110 print "heikin=";heikin 120 130 data 50, 92, 78, 32, 10, 60 140 data 88, 36, 75, 62, 59, 99 150 end dim dim x(100), y(100) x 100 y 100 10 3.1 () 1 2 3 4 5 6 7 8 (%) 85.2 98.4 54.7 99.0 98.5 45.1 87.8 81.4 (%) 67.5 90.2 13.7 84.1 45.6 42.2 65.0 57.6 4 BASIC y 4.1: (0,0) (x,y) 7
400650 4.1 () y = x 2 (sin x) 2 10 x 10 15 y 100 100-10 (0,0) 10-15 4.2: 400 400 x y 4.2 x 400 ±10 x = 0 x0 = 200 1 y 400 100 ( 15) = 115 y = 0 y0 = 400 / 115 * 100 1 x 20 400 dx = 400 / 20 y 115 400 dy = 400 / 115 (x,y) px = x0 + x *dxpy = y0 + (-y)*dy y 1 y x0 = 400/20 10 = 200 8
10 ex 4-1 20 screen 3,,0,1 : cls 3 30 x0 = 200 : y0 = 400 / 115 * 100 (0,0) 40 dx = 400 / 20 : dy = 400 / 115 1 50 line (x0 + (-10)*dx, y0)-(x0 + 10*dx, y0),4 x 60 line (x0, y0 + 15*dy)-(x0, y0 + (-100)*dy),4 y ( 70 for x=-10 to 10 step 1 1 x 80 line (x0 + x*dx, y0+3)- (x0 + x*dx, y0-3),4 90 next x 100 for y=100 to -15 step -10 10 y 110 line(x0-3, y0 + (-y)*dy)-(x0+3, y0 + (-y)*dy),4 120 next y 130 for x = -10 to 10 step.05 0.05 140 y = x^2*sin(x)^2 150 pset(x0 + x*dx, y0 + (-y)*dy),5 (x,y) 160 next x 170 end line 2 line(x1,y1)-(x2,y2),c (x1,y1) (x2,y2) c :1 :2:3:4:5:6:7 pset pset(x,y),c (x,y) c :1:2:3:4:5:6 :7 4.2 () 1s 4πr 2 ψ 2 0 r 3 1s ψ = 1 } exp { ra0 πa 3 0 (1) a 0 =0.529ÅBohr 9
10 ex 4-2 20 screen 3,,0,1 : cls 3 30 x0 = 0 : y0 = 400 (0,0) 40 dx = 400 / 3 : dy = 400 / 2 1 y 2 50 line(x0,y0)-(x0 + 3*dx, y0 + (-2)*dy), 4, B,B box 60 for x = 0 to 3 step.5 0.5 x 70 line(x0 + x*dx, y0)-(x0 + x*dx, y0-10), 4 80 next x 90 for y = 0 to 2 step.1 0.1 y 100 line(x0, y0 + (-y)*dy)-(x0+10, y0+(-y)*dy), 4 110 next y 120 pi = 3.14159 : a =.529 130 for r = 0 to 3 step.005 0.05 140 p = exp(-r/a)/sqr(pi*a^3) ψ 150 y = 4 * pi * r^2 * p^2 4πr 2 ψ 2 160 pset(x0 + r * dx, y0 + (-y)*dy),5 (r,y) 170 next r 180 end 4.1 () 3s 4πr 2 ψ 2 0 r 3 3s ψ = 1 ( 1 r {27 18 81 3πa 3 0 a 0 ) ( ) } 2 ( r + 2 exp r ) a 0 3a 0 (2) 4.2 () 3.1 12 line 4.3 () 3.1 line 5 5.1 () 10
10 ex 5-1 20 screen 3,,0,1:cls 3 30 dx = 400 : dy = 400 40 line(0,0)-(dx,dy),4,b 50 if x <= 0 then xs = 1 x 60 if x >= dx then xs = -1.1 x 70 if y <= 0 then ys = 1.2 y 80 if y >= dy then ys = -1 y 90 circle(x, y),7,0 100 x = x + xs : y = y + ys 110 circle(x, y),7,5 120 goto 50 50 130 end circle circle(x, y),r,c (x,y) r c :1:2 :3:4:5:6:7 5.2 () 11
10 ex 5-2 20 screen 3,,0,1:cls 3 30 dx = 640 : dy = 400 40 x = 40 : y = 40 : z = 300 50 xs = 3 : ys = 3 : zs = 10 : s = 0 60 while 1 wend 70 j = -j + 1 : screen 3,,j,16*(1-j)+1 : cls 2 2 80 if x <= 30 or x >= dx-30 then xs = -xs x 90 if y <= 30 then ys = -ys y 100 if y >= dy-30 and abs(z-x) <= 30 then ys = -ys : s = s + 1 110 if y >= 410 then 180 120 k$ = inkey$ 130 if k$ = "7" then z = z - zs 7 140 if k$ = "9" then z = z + zs 9 150 line(z-20, 377)-(z+20, 385),6,B 160 x = x + xs : y = y + ys : circle(x,y),5,5 170 wend 180 screen 3,,0,1:cls 3 190 print "GAME OVER!! SCORE:";s 200 end while wend while n <= 10 wend while wend 1 0 n <= 10 n=5 1 n=12 0 while 1 5.1 goto 5.2 while goto goto goto 5.1 () 12
6 6.1 y 6.1: y = Ax + B (3) N (x i, y i )(i = 1, 2,, N) AB y 2 E(A, B) E(A, B) = N (y i Ax i B) 2 (4) i=1 E A B 0 { } E N N N A = 2 A x 2 i + B x i x i y i = 0 { i=1 i=1 i=1 } E N N B = 2 A x i + BN y i = 0 i=1 AB { N N A = N x i y i B = { N i=1 x 2 i i=1 i=1 N x i i=1 i=1 N N y i N x i i=1 i=1 i=1 ( y i }/ N N N ) 2 x 2 i x i i=1 i=1 ( x i y i }/ N N N ) 2 x 2 i x i i=1 i=1 (5) (6) 13
6.1 () 5 y = Ax + B AB x i y i 1 0.8 2 1.95 3 2.3 4 2.64 5 3.12 7 A + B (7) [A] v(t) = d[a] = k[a] (8) dt t = 0 [A] [A] 0 ln [A] [A] 0 = kt (9) [A] = [A] 0 e kt (10) 1 f(t, y) dy = f(t, y) dt y(0) = a (11) a y(t) t > 0 f(t, y) 7.1: 14
t j t = t j f(t j, y j ) y j t j t y y j+1 t = t j y j+1 y j = f(t j, y j ) (12) t 0 t T N t = 0 y(0) = a 1. t := T/N y old := a 2. j = 0, 1, N 1 t := j t y new := y old + tf(t, y) := 7.1 () 8 [A] [A] 0 = 1 0 t 200 k = 0.0125k = 0.0250k = 0.0500 k = 0.1000 4 N N 1. t := T/N y old := a 2. j = 0, 1, N 1 t := j t k 1 := f(t, y) ( k 2 := f t + t 2, y + t ) 2 k 1 ( k 3 := f t + t 2, y + t ) 2 k 2 k 4 := f (t + t, y + tk 3 ) y new := y old + t 6 (k 1 + 2k 2 + 2k 3 + k 4 ) 7.2 () 7.1 7.1 () 15
xy x+y 10 ex 6-1 20 x=1: y=3 30 gosub *test *test 40 x=5 : y=-2 50 gosub *test 60 end 70 n<10 30 90 80 *test 90 print "x+y=";x+y 100 return return n88basic xy gosub return return GOSUB RETURN gosub 100 gosub *sub 100 *sub * return 16