home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 53
/
053.d81
/
bytes
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
2KB
|
68 lines
4 dim n(3),nd(3)
5 qq%=0:aa=0:ae$="number of decimal places (0-7):":gosub 1600::at=int(at)
6 nd(1)=at:nd(2)=at:nd(3)=at
7 ifat<0orat>7thenprint"value too large":ford=1to2000:next:goto5
9 gosub5000:goto5
10 a1$="":print"[158]";
20 get a$:if a$="" then 20
30 a=asc(a$):if a=20 thengosub200:goto20
40 if a=13then 100
50 if a$="."ora$="," then80
60 if a$ = "-" and len(a1$) = 0 then 80
65 iflen(a1$)>6 then 20
70 if a < 48 or a > 60 then20
80 a1$=a1$+a$
90 print a$;:goto 20
100 print"":dv=0:l =len(a1$):a = 0:at = 0:p = 0:an = 1
110 for i=1 to l:a$ = mid$(a1$,i,1)
115 if a$="-" then an=-1:goto160
120 ifa$=","then160
130 if a$="."thendv=1:goto160
140 if dv=0 then a=val(a$):at = at*10 + a
150 if dv=1 then p=p+1:a=val(a$):at = at + a/(10^p)
160 next:at=at*an:return
200 l=len(a1$):ifl=0then return
210 printa$;:a1$=left$(a1$,l-1):return
1600 poke 53280,6:poke53281,6:if aa<>0then1615
1605 print "[147] bytes run it"
1610 print " display formatting"
1611 if qq%=1thenprint:print" enter three numbers to be formatted"
1615 print ae$;:gosub 10
1620 print "":return
1640 print " again (y/n)? ";
1650 geta$:if a$=""then1650
1660 if a$="y"then 1680
1670 if a$<>"n"then1650
1675 goto2000
1680 return
2000 :
2560 open15,8,15,"r0:hello connect=hello connect":input#15,er,er$:close15
2562 ifer<>63 then print"[147]":end
2570 load"hello connect",8,1
3990 ; *********************************
3991 ; routine as it appears in loadstar
3992 ; *********************************
4000 n=.5*(1/10^nd)+n:e=int(n*10^nd):e1$=str$(e):em$=" "
4010 if len(e1$)>3 then if mid$(e1$,len(e1$)-3,1)="e"then 4110
4020 if left$(e1$,1)="-"then em$="-":e1$=" "+right$(e1$,len(e1$)-1)
4030 l=len(e1$)-1:if l<ndthen e1$=right$("00000000"+right$(e1$,l),nd)
4040 e1$=" "+e1$:e$="."+right$(e1$,nd)+em$
4050 l=len(e1$):for i=1 to 3
4060 e$=mid$(e1$,(l-3*i-nd+1),3)+e$
4070 if mid$(e1$,(l-3*i-nd),1)=" "then 4090
4080 e$=","+e$
4090 next:e$=" "+e$
4100 e$=right$(e$,16):return
4110 e$ = " "+e1$+" ":goto4100
4120 ; ********************************
4121 ; end of routine
4122 ; ********************************
4123 ;
5000 forj=1to3:qq%=1:aa=0:ae$="enter entry #"+str$(j)+": ":gosub1600:n(j)=at
5015 next
5020 for j=1to3:n=n(j):nd=nd(j):gosub4000
5030 print "item #"j" "n(j),e$:next:gosub1640
5040 return
5100 print "number of decimals in conflict[145][145][145][145][145]"
5110 print " [145]":goto5010