home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 158
/
158.d81
/
pollster
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
6KB
|
153 lines
5 poke 45,0:poke 46,52:clr:dim z(51,2),x%(200,50)
10 for i=1 to 4:read c$(i):next:for i=1 to 6:read d$(i):next
15 data "[165]","[181]","[182][146]","[167][146]","<","=",">","<=",">=","<>"
20 for a=1 to 5:gosub 690:print "[147]":next:e$=chr$(13)+" "
25 poke646,6:poke53281,1:poke53280,1:poke53272,23:deffnq(a)=(a+7)*1024
30 a=-6:gosub690:a=1
31 poke53280,0:poke53281,0:print"[147]";:forjj=1to38:print"[158][192][157] [157][192][145][145]";:next
32 print:printtab(12)"[208] [207] [204] [204] [211] [212] [197] [210]
33 [153]e$;"1sys. open(NULL)rite (NULL)urvey"e$"2sys. openatndminister (NULL)urvey"e$;
34 [153]"3sys. openatnnalyze str$ata"e$"4sys. openstr$isk (NULL)perations"e$"5sys. openvalxit to (NULL)(NULL)atnstr$(NULL)(NULL)atn(NULL)stop
40 geta$:ifa$<"1"ora$>"5"then40
45 poke53281,1:poke53280,1:poke646,6:on val(a$) goto 55,95,240,500,40000:goto 45
50 print "[147]":end
55 gosub 690:q=fnq(a)
60 gosub 645:print " [208][199]#";a;" [198]1: [146] [198]3:-[208][199][160][160][198]5:+[208][199] [198]7:[205][197][206][213]";
65 k=0:j=919:gosub 620:if x>j then a$="[145]"
70 t=asc(a$):if t=147 then print "[147]":goto 60
75 if t>132 and t<137 then a$=" [146]":on t-133 goto 85,90,30
80 print a$;:goto 65
85 a=a+(a>1):goto 55
90 a=a-(a<5):goto 55
95 a=-6:gosub 690:print"[147]" tab(11) "[193][196][205][201][206][201][211][212][197][210][160][211][213][210][214][197][217]"
100 print e$;"1. [195]onduct [211]urvey";e$;"2. [210]eview [210]espondent";e$;"3. [205]ain[160][205]enu"
105 get a$:on val(a$) goto 120,110,30:goto 105
110 input "[210]espondent #";n:if n>m or n<1 then 95
115 d=1:goto 130
120 if m=200 then 95
125 m=m+1:n=m
130 a=1:for i=1 to p:a$=str$(x%(n,i)):j=1:for k=z(i,1) to z(i,2):x=160
135 if d=1 and j<len(a$) then j=j+1:x=asc(mid$(a$,j,1))+128
140 poke k,x:next k:next i:d=0
145 gosub 690:q=fnq(a):gosub 645
150 print " [195][210][212] [210][211][208][196][212]:";n;" [208][199]:";a;" [212][204] [210][211][208][196][212][211]:";m
155 print " [198]1:[206][197][215][160][210][211][208][196][212] [198]3:-[208][199] [198]5:+[208][199] [198]7:[205][197][206][213]";
160 for i=1 to p:if z(i,0)<>a then next:goto 220
165 k=z(i,1)-q:gosub 640:j=z(i,2)-q
170 gosub 620:t=asc(a$):if x>j or t=17 then i=i-(i<p and z(i+1,0)=a):goto 165
175 if t=145 then i=i+(i>1 and z(i-1,0)=a):goto 165
180 if t=147 then 230
185 if t>132 and t<137 then on t-132 goto 210,200,205,210
190 if (t>47 and t<58) or t=32 then print "";a$;"[146]";
195 goto 170
200 a=a+(a>1):goto 145
205 a=a-(a<5):goto 145
210 for i=1 to p:b$="":for k=z(i,1) to z(i,2):b$=b$+chr$(peek(k)-128):next k
215 x%(n,i)=val(b$):next i:on-(t=133) goto 120:goto 95
220 get a$:if (a$<"[133]" or a$>"[136]") and a$<>"[147]" then 220
225 t=asc(a$):goto 180
230 gosub 645:input "[196][197][204][197][212][197] [210][197][211][208][207][206][196][197][206][212] (y/n)[146]";a$:if a$<>"y" then 145
235 for j=1 to p:x%(n,j)=x%(m,j):x%(m,j)=0:next j:m=m-1:goto 95
240 print "[147]" tab(11) "[193][206][193][204][217][218][197][160][196][193][212][193][160][198][201][204][197]"
245 print e$;"1. [211]elect [210]ecords";e$;"2. [195]lear [211]electors";
250 print e$;"3. [205]ean";e$;"4. [198]requency/[208]ercent";e$;"5. [205]ain [205]enu"
255 n=1:get a$:a=val(a$):on a goto 265,260,325,325,30:goto 255
260 sl=0:goto 240
265 input "[147][211]elector [201]tem #";si(n):if si(n)<1 or si(n)>p then 260
270 print "";:for i=1 to 6:printtab(21) d$(i):next
275 input "[210]elational [207]perator";a$:for i=1 to 6:if a$<>d$(i) then next:goto 260
280 sr(n)=i:input "[195]ritical [214]alue";sv(n):if n=2 then 290
285 input "[193]nother selector (y/n)";a$:if a$="y" then n=2:goto 265
290 print "[211]elect if";:fori=1ton:print" item #";si(i);d$(sr(i));sv(i);:next
295 print:input "(y/n)";a$:sl=-n*(a$="y"):goto 240
300 k=1
305 x=x%(i,si(k)):v=sv(k):s=sr(k):r=-(x<v)-2*(x=v)-3*(x>v)
310 r=-(r=s)-(s=4 and r<3)-(s=5 and r>1)-(s=6 and r<>2)
315 if r=1 and k<sl then k=2:goto 305
320 return
325 gosub 685:input "[201]tem #";j:if j<1 or j>p then 240
330 gosub 680:if a=4 then 430
335 sx=0:ss=0:n=0
340 for i=1 to m:if sl>0 then gosub 300:if r=0 then 360
345 x=x%(i,j):if x<mn or n=0 then mn=x
350 if x>mx or n=0 then mx=x
355 sx=sx+x:ss=ss+x^2:n=n+1
360 next i:if n=0 then gosub 665:goto 240
365 me=sx/n:sd=sqr((ss-n*me^2)/(n-1)):gosub 650
370 print e$;"[212]otal:";n;e$;"[205]ean:";me;e$;"[211]tand. [196]ev.:";sd;
375 print e$;"[205]in:";mn;e$;"[205]ax:";mx
380 input"[208]lot [196]ata (y/n)";a$:if a$<>"y" then 240
385 gosub 650:d=(mx-mn)/37:def fn p(t)=(t-mn)/d+1865.5
390 for i=1 to m:if sl>0 then gosub 300:if r=0 then 410
395 x=fn p(x%(i,j))
400 for z=x to x-680 step-40:if peek(z)=32 then poke z,42:goto 410
405 next z:poke z,170
410 next i:x=fn p(me):poke x+40,24
415 x=fn p(me-sd):poke x+40,107:x=fn p(me+sd):poke x+40,115
425 gosub 670:goto 240
430 for k=1 to 10:f(k)=0:n(k)=0:next k:n=0:d=1
435 for i=1 to m:if sl>0 then gosub 300:if r=0 then 465
440 n=n+1:x=x%(i,j):if n=1 then n(1)=x
445 for z=1 to d:a=-(x<n(z))-2*(x=n(z)):on a goto 450,460:next z
450 d=d+1:if d>10 then d=10:goto 465
455 if a=1 then for c=d to z+1 step-1:n(c)=n(c-1):f(c)=f(c-1):next c:f(z)=0
460 n(z)=x:f(z)=f(z)+1
465 next i:if n=0 then gosub 665:goto 240
470 gosub 650:a$=chr$(13)+" [182]":for i=1 to d:r=f(i)/n:k=32*r:c=int(k)
475 print a$;:if c>0 then for j=1 to c:print " [146]";:next j
480 print c$((k-c)*4+.5);a$;n(i);"/";f(i);"/";r*100;"%";:next i
485 print a$;:for q=1 to 32:print "[175]";:next q
490 print spc(8) "[212][207][212][193][204]:";n
495 gosub 670:goto 240
500 print "[147]" tab(12) "[198][201][204][197][160][207][208][197][210][193][212][201][207][206][211]"
505 print e$;"1. [204]oad [211]urvey";e$;"2. [211]ave [211]urvey";e$;"3. [204]oad [196]ata";e$;
510 print "4. [211]ave [196]ata";e$;"5. [205]ain [205]enu"
515 get a$:a=val(a$):if a<1 or a>5 then 515
520 if a=5 then 30
525 gosub 685:a$="":input " [198]ile [206]ame";a$:if a$="" then 500
530 gosub 680:b$=",":on a goto 600,545,590
535 open2,8,2,"@0:"+a$+",s,w":print#2,m;b$;p:for i=1 to m:for j=1 to p
540 print#2, x%(i,j):next j:next i:close2:goto 500
545 for r=5 to 1 step-1:q=fnq(r):for c=q+919 to q step-1
550 if peek(c)=32 then next c:next r
555 c=c-q:open 2,8,2,"@0:"+a$+",s,w":print#2,r;b$;c
560 i=1:for a=1 to r:q=fnq(a):for k=q to q+919+(919-c)*(a=r)
565 x=peek(k):print#2,chr$(x);:if x<>160 or i>50 then 580
570 if peek(k-1)<>160 then z(i,1)=k:z(i,0)=a
575 if peek(k+1)<>160 then z(i,2)=k:i=i+1
580 next k:next a:p=i-1:print#2,chr$(13);p
585 for i=1 to p:print#2,z(i,0);b$;z(i,1);b$;z(i,2):next i:close2:goto 500
590 open2,8,2,"0:"+a$+",s,r":input#2,m,p:for i=1 to m:for j=1 to p
595 input#2, x%(i,j):next j:next i:close2:goto 500
600 open 2,8,2,"0:"+a$+",s,r":input#2,r,c
605 for a=1 to r:q=fnq(a):for k=q to q+919+(919-c)*(a=r)
610 get#2,a$:poke k,asc(a$+chr$(0)):next k:next a:input#2,p
615 for i=1 to p:input#2,z(i,0),z(i,1),z(i,2):next i:close2:goto 500
620 poke 216,0:x=peek(211):x=x+40*(x>39)+peek(214)*40:if x<k or x>j then return
625 t=x+q:z=peek(t):c=z+128+256*(z>127)
630 get a$:if a$<>"" then return
635 poke t,c:for r=1 to 80:next:poke t,z:goto 630
640 r=int(k/40):c=k-r*40:poke 211,c:poke 214,r:sys 58732:return
645 k=920:gosub 640:for k=k to 999:poke k+q,32:next k:return
650 print "[147]" tab(15) "[201][212][197][205] #";j:if sl=0 then return
655 printtab(10/sl);
660 for i=1 to sl:print "[item #";si(i);d$(sr(i));sv(i);"[157]]";:next i:return
665 printtab(15) "[206][207][160][210][197][195][207][210][196][211]"
670 get a$:if a$="" then 670
675 return
680 printtab(16) "[215][207][210][203][201][206][199][146]":return
685 j=55347+a*80:for i=j to j+20:poke i,2:next:return
690 poke 53272,(peek(53272) and 15) or (a+7)*16:poke 648,(a+7)*4:return
40000 fori=0to21:poke828+i,8+i:next
40010 ifdv<8ordv>29ordv=8then40030
40020 a=peek(828):b=peek(828+dv-8):poke828,b:poke828+dv-8,a
40030 a$="presenter":gosub40040:a$="hello connect"
40040 forj=8to29:i=peek(828+j-8):ifi=14thennext
40050 close2:open2,i,2:close2:ifstthen40070
40060 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then40090
40070 next:ifa$="presenter"thenreturn
40080 print"[147]":poke53272,23:poke186,8:poke2048,0:p