00010 rem ************************************************** 00020 rem * digirdr.bas - Translate digits to words 00030 rem * 2016 David Meyer +JMJ 00040 rem ************************************************** 00090 dim n(11), w$(10) 00100 print "DIGITS-TO-WORDS" 00110 print 00120 print "Number (0-9,999,999,999) to translate (Q to quit)"; 00130 input n$ 00140 if n$="q" or n$="Q" then stop 00150 change n$ to n 00160 v=1 00170 d=1 00179 rem DO UNTIL 00180 if d>n(0) or v=0 then 500 00190 if n(d)<48 or n(d)>57 then v=0 00200 d=d+1 00490 goto 179 00500 rem END DO 00510 if v=1 then 540 00520 print "Not a valid number" 00530 goto 7999 00540 rem END IF 00550 if n(0)<11 then 700 00560 print "Number out of range" 00570 goto 7999 00700 rem END IF 00710 for d=1 to n(0) 00720 if n(d)=48 then w$(d)="zero" 00730 if n(d)=49 then w$(d)="one" 00740 if n(d)=50 then w$(d)="two" 00750 if n(d)=51 then w$(d)="three" 00760 if n(d)=52 then w$(d)="four" 00770 if n(d)=53 then w$(d)="five" 00780 if n(d)=54 then w$(d)="six" 00790 if n(d)=55 then w$(d)="seven" 00800 if n(d)=56 then w$(d)="eight" 00810 if n(d)=57 then w$(d)="nine" 00820 next d 00825 print 00830 for d=1 to n(0) 00840 print w$(d)+" "; 00850 next d 00860 print 07999 goto 110 09999 end