home *** CD-ROM | disk | FTP | other *** search
/ Rockford Magazine / Rockford_Magazine_022_19xx_-_de_Disk_4_of_4_Side_B.d64 / zahlenwandeln (.txt) < prev   
Commodore BASIC  |  2023-02-26  |  2KB  |  84 lines

  1. 10 rem
  2. 20 print"[147][154]":poke53281,0:poke53280,0:poke53272,21
  3. 30 rem (c) by k.-h. hess
  4. 40 dimrz$(7),rz(7)
  5. 50 hv$="ivxlcdm":rem hilfsvariable
  6. 60 h0=.5:forie=1to7:f%=2:ifint(ie/2)=ie/2thenf%=5
  7. 70 h0=int(h0*f%):rz(ie)=h0:rz$(ie)=mid$(hv$,ie,1)
  8. 80 nextie
  9. 90 print"[147]r o e m i s c h e    z a h l e n ! ! !"
  10. 100 print"u m w a n d l u n g"
  11. 110 print"'r'[146]  =  roemisch [195][195][195]> arabisch"
  12. 120 print"'a'[146]  =  arabisch [195][195][195]> roemisch"
  13. 130 printtab(12)"'e'  =  ende"
  14. 140 print"":foruu=1to40:print"[209]";:next
  15. 150 print"bitte, waehlen sie !!!"
  16. 160 getx$:ifx$=""then160
  17. 170 ifx$="r"then200
  18. 180 ifx$="a"then620
  19. 190 goto160
  20. 200 print"[147]":rem roemisch -> arabisch
  21. 210 print
  22. 220 input"roemische zahl:     *[157][157][157]";rz$
  23. 230 ifrz$="*"thenprint"[145]";:goto220
  24. 240 ifrz$="e"thenend
  25. 250 lr=len(rz$)
  26. 260 rem plausibilierung
  27. 270 forie=1tolr
  28. 280 z$=mid$(rz$,ie,1):z=asc(z$)
  29. 290 vh%=1:forh1=1to7:ifz=asc(rz$(h1))thenvh%=0
  30. 300 nexth1
  31. 310 ifvh%thenvh=ie:ie=lr
  32. 320 nextie
  33. 330 ifvh%thenie=vh:goto570
  34. 340 rem pruefung
  35. 350 h1=0:h0=0:e0=0:e1=0:e2=0:m%=0:m0%=0:zg=0:ie=0:zv$="":m1%=0
  36. 360 ie=ie+1:ifie>lrthen550
  37. 370 h1=0
  38. 380 z$=mid$(rz$,ie,1):ifz$=zv$thenzg=zg+1:goto400
  39. 390 zg=0:zv$=z$
  40. 400 ifzg>0thenifz$="v"orz$="l"orz$="d"then570
  41. 410 ifzg>2thenifz$<>"m"then570
  42. 420 h1=h1+1:ifrz$(h1)<>z$then420
  43. 430 ifh1=>h0thenifm%then490
  44. 440 ifm1%thenifh1>h0thenifh1=>h3then570
  45. 450 ifh1=h0thenm0%=1:goto510
  46. 460 ifh1>h0thenifm0%then570
  47. 470 ifh1>h0thenifie>1thenifh0/2=int(h0/2)then570
  48. 480 ifh1>h0thenifie>1thenm%=m%+1:m1%=1:h3=h2:goto510
  49. 490 ifh1=>h2thenifie>1then570
  50. 500 h2=h1:m%=0:m0%=0
  51. 510 h0=h1:ifm%>1then570
  52. 520 e0=rz(h1):ifm%=1thene2=e2-(2*e1)
  53. 530 e1=e0:e2=e2+e1
  54. 540 goto360
  55. 550 print"roemisch ";rz$;"[146]  =  arabisch ";int(e2)
  56. 560 goto610
  57. 570 rem fehlermeldung
  58. 580 print"  [195][195][195]> falsch: ";left$(rz$,ie-1);
  59. 590 print""mid$(rz$,ie,1)"[146]"mid$(rz$,ie+1)
  60. 600 print"  eingabe wiederholen!"
  61. 610 goto210
  62. 620 print"[147]":rem arabisch -> roemisch
  63. 630 print
  64. 640 input"arabische zahl:     0      [157][157][157][157][157][157][157][157][157]";az$
  65. 650 ifaz$="e"thenend
  66. 660 az=val(az$)
  67. 670 az=int(az):ifaz=0thenprint"[145]";:goto640
  68. 680 ifaz<0oraz>10000thenprint" falsche eingabe!":goto630
  69. 690 rz=az
  70. 700 rz$=""
  71. 710 h1=0
  72. 720 h1=h1+1:ifh1>7thenrz$=rz$+"m":rz=rz-rz(7):goto710
  73. 730 sg=sgn(rz-rz(h1)):ifsg>0then720
  74. 740 ifsg=0thenrz$=rz$+rz$(h1):goto820
  75. 750 forh2=1to(h1-1)step2:vg=rz(h1)-rz:vg%=0:vh%=0
  76. 760 ifvg=rz(h2)thenrz$=rz$+rz$(h2)+rz$(h1):goto820
  77. 770 ifrz>rz(h2)andrz<rz(h2+2)then:ifvg<rz(h2)thenvh%=1
  78. 780 ifvh%then:rz$=rz$+rz$(h2)+rz$(h1):vg%=1
  79. 790 ifvg%then:rz=rz+rz(h2)-rz(h1):rz=abs(rz):goto710
  80. 800 next
  81. 810 rz$=rz$+rz$(h1-1):rz=rz-rz(h1-1):goto710
  82. 820 print"arabisch ";az;"[146]  =  roemisch ";rz$
  83. 830 goto630
  84.