PRINTUSING

Author(s): Jack Armstrong
Publication: The Plotter
Pub Details: The Plotter v5 n10 (Volume 5, Issue 10)
Date: October 1987
Pages: 7
   5 REM This is an updated ver-sion of Dick Wagners PRINTUSING routine showing a demo of how itwill change your input and printit out in an orderly fashion fora neat appearance. It shows how ordinary input prints, then willprint the same material in  for-matted fashion. Revisions are byJack Armstrong, 8-87.
6 REM
10 INK 0: PAPER 6: BORDER 5: CLS
20 PRINT '" THIS PROGRAM WILL INTAKE YOUR NUMBERS AND PRINT THEM OUT IN A ""PRINTUSING"" FORMAT EVEN IF THEY HAVE NO LEADING DIGIT AND EVEN IF THEY HAVE NO DECIMAL; IT WILL HANDLE NUMBERS UP TO 9 CHARACTERS LONG (INCLUDING THE DECIMAL POINT.)"
30 PRINT INK 1;'" PRESS A KEY TO START...": PAUSE 0: CLS
40 PRINT '"How many numbers will we use?": INPUT many: PRINT ' INK 2;many;" numbers"
50 PRINT '"How long is the longest number? (long=total characters includingthe decimal point if it has one)": INPUT long: PRINT ' INK 2;"Longest #:";long
60 POKE 23658,8: INPUT "Clear the screen? Y/N "; LINE z$: IF z$="Y" THEN CLS
70 LET tot=0: DIM m(many): LET i$="######.##"
80 FOR l=1 TO many
90 INPUT ("INPUT #";l;" of ";many);" ";m(l)
100 LET tot=tot+m(l): NEXT l
110 PRINT ''
120 FOR l=1 TO many
130 PRINT INK 2;m(l);TAB 3+long;("Old format" AND l=1)
140 NEXT l
150 PRINT '
160 FOR l=1 TO many
170 LET xi=m(l)
180 GO SUB 2000
190 PRINT INK 1;x$;TAB 3+long;("PrintUsing format" AND l=1)
200 NEXT l
210 PRINT "---------": PRINT INK 1;TAB 9-long;tot
300 STOP
2000 REM
2010 LET il=LEN i$
2020 LET id=0
2030 FOR j=1 TO il
2040 LET j$=i$(j)
2050 IF j$=CHR$ 46 THEN LET id=LEN i$-j
2060 NEXT j
2070 LET x$=STR$ INT (ABS xi*10↑id)
2080 LET xd=LEN x$-id
2090 FOR j=0 TO -xd
2100 LET x$="0"+x$
2110 NEXT j
2120 LET xd=LEN x$-id
2130 IF id>0 THEN LET x$=x$( TO xd)+"."+x$(xd+1 TO )
2140 FOR j=1 TO il-LEN x$
2150 LET x$=CHR$ 32+x$
2160 NEXT j
2170 RETURN
3000 SAVE "05,pusing" LINE 10

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.