home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 158 / 158.d81 / pollster (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  153 lines

  1. 5 poke 45,0:poke 46,52:clr:dim z(51,2),x%(200,50)
  2. 10 for i=1 to 4:read c$(i):next:for i=1 to 6:read d$(i):next
  3. 15 data "[165]","[181]","[182][146]","[167][146]","<","=",">","<=",">=","<>"
  4. 20 for a=1 to 5:gosub 690:print "[147]":next:e$=chr$(13)+"           "
  5. 25 poke646,6:poke53281,1:poke53280,1:poke53272,23:deffnq(a)=(a+7)*1024
  6. 30 a=-6:gosub690:a=1
  7. 31 poke53280,0:poke53281,0:print"[147]";:forjj=1to38:print"[158][192][157] [157][192][145][145]";:next
  8. 32 print:printtab(12)"[208] [207] [204] [204] [211] [212] [197] [210]
  9. 33 [153]e$;"1sys. open(NULL)rite (NULL)urvey"e$"2sys. openatndminister (NULL)urvey"e$;
  10. 34 [153]"3sys. openatnnalyze str$ata"e$"4sys. openstr$isk (NULL)perations"e$"5sys. openvalxit to (NULL)(NULL)atnstr$(NULL)(NULL)atn(NULL)stop
  11. 40 geta$:ifa$<"1"ora$>"5"then40
  12. 45 poke53281,1:poke53280,1:poke646,6:on val(a$) goto 55,95,240,500,40000:goto 45
  13. 50 print "[147]":end
  14. 55 gosub 690:q=fnq(a)
  15. 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]";
  16. 65 k=0:j=919:gosub 620:if x>j then a$="[145]"
  17. 70 t=asc(a$):if t=147 then print "[147]":goto 60
  18. 75 if t>132 and t<137 then a$=" [146]":on t-133 goto 85,90,30
  19. 80 print a$;:goto 65
  20. 85 a=a+(a>1):goto 55
  21. 90 a=a-(a<5):goto 55
  22. 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]"
  23. 100 print e$;"1. [195]onduct [211]urvey";e$;"2. [210]eview [210]espondent";e$;"3. [205]ain[160][205]enu"
  24. 105 get a$:on val(a$) goto 120,110,30:goto 105
  25. 110 input "[210]espondent #";n:if n>m or n<1 then 95
  26. 115 d=1:goto 130
  27. 120 if m=200 then 95
  28. 125 m=m+1:n=m
  29. 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
  30. 135 if d=1 and j<len(a$) then j=j+1:x=asc(mid$(a$,j,1))+128
  31. 140 poke k,x:next k:next i:d=0
  32. 145 gosub 690:q=fnq(a):gosub 645
  33. 150 print " [195][210][212] [210][211][208][196][212]:";n;" [208][199]:";a;" [212][204] [210][211][208][196][212][211]:";m
  34. 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]";
  35. 160 for i=1 to p:if z(i,0)<>a then next:goto 220
  36. 165 k=z(i,1)-q:gosub 640:j=z(i,2)-q
  37. 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
  38. 175 if t=145 then i=i+(i>1 and z(i-1,0)=a):goto 165
  39. 180 if t=147 then 230
  40. 185 if t>132 and t<137 then on t-132 goto 210,200,205,210
  41. 190 if (t>47 and t<58) or t=32 then print "";a$;"[146]";
  42. 195 goto 170
  43. 200 a=a+(a>1):goto 145
  44. 205 a=a-(a<5):goto 145
  45. 210 for i=1 to p:b$="":for k=z(i,1) to z(i,2):b$=b$+chr$(peek(k)-128):next k
  46. 215 x%(n,i)=val(b$):next i:on-(t=133) goto 120:goto 95
  47. 220 get a$:if (a$<"[133]" or a$>"[136]") and a$<>"[147]" then 220
  48. 225 t=asc(a$):goto 180
  49. 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
  50. 235 for j=1 to p:x%(n,j)=x%(m,j):x%(m,j)=0:next j:m=m-1:goto 95
  51. 240 print "[147]" tab(11) "[193][206][193][204][217][218][197][160][196][193][212][193][160][198][201][204][197]"
  52. 245 print e$;"1. [211]elect [210]ecords";e$;"2. [195]lear [211]electors";
  53. 250 print e$;"3. [205]ean";e$;"4. [198]requency/[208]ercent";e$;"5. [205]ain [205]enu"
  54. 255 n=1:get a$:a=val(a$):on a goto 265,260,325,325,30:goto 255
  55. 260 sl=0:goto 240
  56. 265 input "[147][211]elector [201]tem #";si(n):if si(n)<1 or si(n)>p then 260
  57. 270 print "";:for i=1 to 6:printtab(21) d$(i):next
  58. 275 input "[210]elational [207]perator";a$:for i=1 to 6:if a$<>d$(i) then next:goto 260
  59. 280 sr(n)=i:input "[195]ritical [214]alue";sv(n):if n=2 then 290
  60. 285 input "[193]nother selector (y/n)";a$:if a$="y" then n=2:goto 265
  61. 290 print "[211]elect if";:fori=1ton:print" item #";si(i);d$(sr(i));sv(i);:next
  62. 295 print:input "(y/n)";a$:sl=-n*(a$="y"):goto 240
  63. 300 k=1
  64. 305 x=x%(i,si(k)):v=sv(k):s=sr(k):r=-(x<v)-2*(x=v)-3*(x>v)
  65. 310 r=-(r=s)-(s=4 and r<3)-(s=5 and r>1)-(s=6 and r<>2)
  66. 315 if r=1 and k<sl then k=2:goto 305
  67. 320 return
  68. 325 gosub 685:input "[201]tem #";j:if j<1 or j>p then 240
  69. 330 gosub 680:if a=4 then 430
  70. 335 sx=0:ss=0:n=0
  71. 340 for i=1 to m:if sl>0 then gosub 300:if r=0 then 360
  72. 345 x=x%(i,j):if x<mn or n=0 then mn=x
  73. 350 if x>mx or n=0 then mx=x
  74. 355 sx=sx+x:ss=ss+x^2:n=n+1
  75. 360 next i:if n=0 then gosub 665:goto 240
  76. 365 me=sx/n:sd=sqr((ss-n*me^2)/(n-1)):gosub 650
  77. 370 print e$;"[212]otal:";n;e$;"[205]ean:";me;e$;"[211]tand. [196]ev.:";sd;
  78. 375 print e$;"[205]in:";mn;e$;"[205]ax:";mx
  79. 380 input"[208]lot [196]ata (y/n)";a$:if a$<>"y" then 240
  80. 385 gosub 650:d=(mx-mn)/37:def fn p(t)=(t-mn)/d+1865.5
  81. 390 for i=1 to m:if sl>0 then gosub 300:if r=0 then 410
  82. 395 x=fn p(x%(i,j))
  83. 400 for z=x to x-680 step-40:if peek(z)=32 then poke z,42:goto 410
  84. 405 next z:poke z,170
  85. 410 next i:x=fn p(me):poke x+40,24
  86. 415 x=fn p(me-sd):poke x+40,107:x=fn p(me+sd):poke x+40,115
  87. 425 gosub 670:goto 240
  88. 430 for k=1 to 10:f(k)=0:n(k)=0:next k:n=0:d=1
  89. 435 for i=1 to m:if sl>0 then gosub 300:if r=0 then 465
  90. 440 n=n+1:x=x%(i,j):if n=1 then n(1)=x
  91. 445 for z=1 to d:a=-(x<n(z))-2*(x=n(z)):on a goto 450,460:next z
  92. 450 d=d+1:if d>10 then d=10:goto 465
  93. 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
  94. 460 n(z)=x:f(z)=f(z)+1
  95. 465 next i:if n=0 then gosub 665:goto 240
  96. 470 gosub 650:a$=chr$(13)+"     [182]":for i=1 to d:r=f(i)/n:k=32*r:c=int(k)
  97. 475 print a$;:if c>0 then for j=1 to c:print " [146]";:next j
  98. 480 print c$((k-c)*4+.5);a$;n(i);"/";f(i);"/";r*100;"%";:next i
  99. 485 print a$;:for q=1 to 32:print "[175]";:next q
  100. 490 print spc(8) "[212][207][212][193][204]:";n
  101. 495 gosub 670:goto 240
  102. 500 print "[147]" tab(12) "[198][201][204][197][160][207][208][197][210][193][212][201][207][206][211]"
  103. 505 print e$;"1. [204]oad [211]urvey";e$;"2. [211]ave [211]urvey";e$;"3. [204]oad [196]ata";e$;
  104. 510 print "4. [211]ave [196]ata";e$;"5. [205]ain [205]enu"
  105. 515 get a$:a=val(a$):if a<1 or a>5 then 515
  106. 520 if a=5 then 30
  107. 525 gosub 685:a$="":input " [198]ile [206]ame";a$:if a$="" then 500
  108. 530 gosub 680:b$=",":on a goto 600,545,590
  109. 535 open2,8,2,"@0:"+a$+",s,w":print#2,m;b$;p:for i=1 to m:for j=1 to p
  110. 540 print#2, x%(i,j):next j:next i:close2:goto 500
  111. 545 for r=5 to 1 step-1:q=fnq(r):for c=q+919 to q step-1
  112. 550 if peek(c)=32 then next c:next r
  113. 555 c=c-q:open 2,8,2,"@0:"+a$+",s,w":print#2,r;b$;c
  114. 560 i=1:for a=1 to r:q=fnq(a):for k=q to q+919+(919-c)*(a=r)
  115. 565 x=peek(k):print#2,chr$(x);:if x<>160 or i>50 then 580
  116. 570 if peek(k-1)<>160 then z(i,1)=k:z(i,0)=a
  117. 575 if peek(k+1)<>160 then z(i,2)=k:i=i+1
  118. 580 next k:next a:p=i-1:print#2,chr$(13);p
  119. 585 for i=1 to p:print#2,z(i,0);b$;z(i,1);b$;z(i,2):next i:close2:goto 500
  120. 590 open2,8,2,"0:"+a$+",s,r":input#2,m,p:for i=1 to m:for j=1 to p
  121. 595 input#2, x%(i,j):next j:next i:close2:goto 500
  122. 600 open 2,8,2,"0:"+a$+",s,r":input#2,r,c
  123. 605 for a=1 to r:q=fnq(a):for k=q to q+919+(919-c)*(a=r)
  124. 610 get#2,a$:poke k,asc(a$+chr$(0)):next k:next a:input#2,p
  125. 615 for i=1 to p:input#2,z(i,0),z(i,1),z(i,2):next i:close2:goto 500
  126. 620 poke 216,0:x=peek(211):x=x+40*(x>39)+peek(214)*40:if x<k or x>j then return
  127. 625 t=x+q:z=peek(t):c=z+128+256*(z>127)
  128. 630 get a$:if a$<>"" then return
  129. 635 poke t,c:for r=1 to 80:next:poke t,z:goto 630
  130. 640 r=int(k/40):c=k-r*40:poke 211,c:poke 214,r:sys 58732:return
  131. 645 k=920:gosub 640:for k=k to 999:poke k+q,32:next k:return
  132. 650 print "[147]" tab(15) "[201][212][197][205] #";j:if sl=0 then return
  133. 655 printtab(10/sl);
  134. 660 for i=1 to sl:print "[item #";si(i);d$(sr(i));sv(i);"[157]]";:next i:return
  135. 665 printtab(15) "[206][207][160][210][197][195][207][210][196][211]"
  136. 670 get a$:if a$="" then 670
  137. 675 return
  138. 680 printtab(16) "[215][207][210][203][201][206][199][146]":return
  139. 685 j=55347+a*80:for i=j to j+20:poke i,2:next:return
  140. 690 poke 53272,(peek(53272) and 15) or (a+7)*16:poke 648,(a+7)*4:return
  141. 40000 fori=0to21:poke828+i,8+i:next
  142. 40010 ifdv<8ordv>29ordv=8then40030
  143. 40020 a=peek(828):b=peek(828+dv-8):poke828,b:poke828+dv-8,a
  144. 40030 a$="presenter":gosub40040:a$="hello connect"
  145. 40040 forj=8to29:i=peek(828+j-8):ifi=14thennext
  146. 40050 close2:open2,i,2:close2:ifstthen40070
  147. 40060 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then40090
  148. 40070 next:ifa$="presenter"thenreturn
  149. 40080 print"[147]":poke53272,23:poke186,8:poke2048,0:p