home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Rockford Magazine
/
Rockford_Magazine_022_19xx_-_de_Disk_4_of_4_Side_B.d64
/
zahlenwandeln
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2023-02-26
|
2KB
|
84 lines
10 rem
20 print"[147][154]":poke53281,0:poke53280,0:poke53272,21
30 rem (c) by k.-h. hess
40 dimrz$(7),rz(7)
50 hv$="ivxlcdm":rem hilfsvariable
60 h0=.5:forie=1to7:f%=2:ifint(ie/2)=ie/2thenf%=5
70 h0=int(h0*f%):rz(ie)=h0:rz$(ie)=mid$(hv$,ie,1)
80 nextie
90 print"[147]r o e m i s c h e z a h l e n ! ! !"
100 print"u m w a n d l u n g"
110 print"'r'[146] = roemisch [195][195][195]> arabisch"
120 print"'a'[146] = arabisch [195][195][195]> roemisch"
130 printtab(12)"'e' = ende"
140 print"":foruu=1to40:print"[209]";:next
150 print"bitte, waehlen sie !!!"
160 getx$:ifx$=""then160
170 ifx$="r"then200
180 ifx$="a"then620
190 goto160
200 print"[147]":rem roemisch -> arabisch
210 print
220 input"roemische zahl: *[157][157][157]";rz$
230 ifrz$="*"thenprint"[145]";:goto220
240 ifrz$="e"thenend
250 lr=len(rz$)
260 rem plausibilierung
270 forie=1tolr
280 z$=mid$(rz$,ie,1):z=asc(z$)
290 vh%=1:forh1=1to7:ifz=asc(rz$(h1))thenvh%=0
300 nexth1
310 ifvh%thenvh=ie:ie=lr
320 nextie
330 ifvh%thenie=vh:goto570
340 rem pruefung
350 h1=0:h0=0:e0=0:e1=0:e2=0:m%=0:m0%=0:zg=0:ie=0:zv$="":m1%=0
360 ie=ie+1:ifie>lrthen550
370 h1=0
380 z$=mid$(rz$,ie,1):ifz$=zv$thenzg=zg+1:goto400
390 zg=0:zv$=z$
400 ifzg>0thenifz$="v"orz$="l"orz$="d"then570
410 ifzg>2thenifz$<>"m"then570
420 h1=h1+1:ifrz$(h1)<>z$then420
430 ifh1=>h0thenifm%then490
440 ifm1%thenifh1>h0thenifh1=>h3then570
450 ifh1=h0thenm0%=1:goto510
460 ifh1>h0thenifm0%then570
470 ifh1>h0thenifie>1thenifh0/2=int(h0/2)then570
480 ifh1>h0thenifie>1thenm%=m%+1:m1%=1:h3=h2:goto510
490 ifh1=>h2thenifie>1then570
500 h2=h1:m%=0:m0%=0
510 h0=h1:ifm%>1then570
520 e0=rz(h1):ifm%=1thene2=e2-(2*e1)
530 e1=e0:e2=e2+e1
540 goto360
550 print"roemisch ";rz$;"[146] = arabisch ";int(e2)
560 goto610
570 rem fehlermeldung
580 print" [195][195][195]> falsch: ";left$(rz$,ie-1);
590 print""mid$(rz$,ie,1)"[146]"mid$(rz$,ie+1)
600 print" eingabe wiederholen!"
610 goto210
620 print"[147]":rem arabisch -> roemisch
630 print
640 input"arabische zahl: 0 [157][157][157][157][157][157][157][157][157]";az$
650 ifaz$="e"thenend
660 az=val(az$)
670 az=int(az):ifaz=0thenprint"[145]";:goto640
680 ifaz<0oraz>10000thenprint" falsche eingabe!":goto630
690 rz=az
700 rz$=""
710 h1=0
720 h1=h1+1:ifh1>7thenrz$=rz$+"m":rz=rz-rz(7):goto710
730 sg=sgn(rz-rz(h1)):ifsg>0then720
740 ifsg=0thenrz$=rz$+rz$(h1):goto820
750 forh2=1to(h1-1)step2:vg=rz(h1)-rz:vg%=0:vh%=0
760 ifvg=rz(h2)thenrz$=rz$+rz$(h2)+rz$(h1):goto820
770 ifrz>rz(h2)andrz<rz(h2+2)then:ifvg<rz(h2)thenvh%=1
780 ifvh%then:rz$=rz$+rz$(h2)+rz$(h1):vg%=1
790 ifvg%then:rz=rz+rz(h2)-rz(h1):rz=abs(rz):goto710
800 next
810 rz$=rz$+rz$(h1-1):rz=rz-rz(h1-1):goto710
820 print"arabisch ";az;"[146] = roemisch ";rz$
830 goto630