Files
gw-basic-2026/tests/programs/stats_calc.bas
Eremey Valetov 1f4c460f4f Phase 5: CI, terminal I/O, Sixel graphics, classic programs
Add GitHub Actions CI with automated build and test. Implement real
terminal I/O with raw mode (enable_raw/disable_raw, proper INKEY$
polling via VMIN=0/VTIME=0, INPUT$ function). Add Sixel graphics
engine with virtual framebuffer (SCREEN 1: 320x200, SCREEN 2:
640x200), Bresenham line drawing, midpoint circle, flood fill PAINT,
DRAW mini-language parser, and Sixel encoder with RLE. Replace all
graphics stubs with real implementations (PSET, LINE, CIRCLE, DRAW,
PAINT, COLOR, SCREEN, POINT). Fix AND/OR/XOR operator precedence
to be lower than relational operators. Add 13 classic test programs
(39 total). Bump version to 0.5.0.
2026-02-10 16:46:34 -05:00

18 lines
485 B
QBasic

10 REM Statistics: mean, variance, std dev
20 N% = 10
30 DIM X(9)
40 DATA 23,45,12,67,34,89,56,78,90,11
50 FOR I = 0 TO 9 : READ X(I) : NEXT I
60 REM Mean
70 S = 0
80 FOR I = 0 TO 9 : S = S + X(I) : NEXT I
90 MEAN = S / N%
100 PRINT USING "Mean: ###.##"; MEAN
110 REM Variance
120 V = 0
130 FOR I = 0 TO 9 : V = V + (X(I) - MEAN) * (X(I) - MEAN) : NEXT I
140 VR = V / N%
150 PRINT USING "Variance: ####.##"; VR
160 PRINT USING "Std Dev: ###.##"; SQR(VR)
170 PRINT "Stats calc OK"