;notes:
;this is how answer changes a number into a string.
;DO NOT attempt to import this file using WLINK83 (it won't work).
;!= means not equal.
;zero is not recognized by this program as a number, but you could in your
;own program by typing (B IS YOUR VARIABLE):
;If not(B	;if B is zero
;Goto X
;here is the program:
\start83\
\comment=
\name=ANSWER
\file=C:\WINDOWS\DESKTOP\CONVERT.TXT
ClrHome
PlotsOff 
CoordOff
Polar
GridOff
AxesOff
ClrDraw
Clear Entries
Text(0,28,"ANSWER  1.0
DelVar A                  ;set A to zero
Ans\->\A:real(A\->\A      ;store the answer to A and make sure its real
"A\!=\int(A\->\Str2       ;we'll use this if A is a decimal (like 1.4 or .23)
If A=int(A                ;if A is an integer, we'll use this. (for an 
"Y\!=\X\->\Str2           ;explanation, goto the end)
DelVar \L\A               ;in case the answer was a string, delete the list
If not(A                  ;it made, and display the message.
Then
Text(7,0,"SYNTAX:
Text(14,0,"[NUMBER]:prgmANSWER
Pause 
Output(1,1,"              ;stops the Done message from appearing.
Return
End
Pause 
ClrDraw
Text(0,0,"ANSWER CONVERTS A REAL NUM
Text(7,0,"INTO Str1
Pause 
Text(14,0,"CONVERTING...
" \->\Str1                ;put a space as the first char of Str0 to prevent
If A<0                    ;errors. If A is less than zero (negative) then
Ans+"\(-)\\->\Str1        ;put a minus sign at the beginning of the number.
abs(A\->\A                ;now we just use A.
While A\>=\1              ;While A is greater than or equal to 1
.1A\->\A                  ;decrease it till it's small enough to work with.
X+1\->\X                  ;keep track of how many times it is decreased
End
Lbl 0
10fPart(A\->\A            ;move the number to the left of the decimal place
If Y=X                    ;to the ones position. If we get to the decimal 
Str1+".\->\Str1           ;point, add it to end of Str1.
Y+1\->\Y                  ;Y keeps track of the number of times in the loop.
Str1+sub("0123456789",int(A)+1,1\->\Str1  ;take the number in the ones place,
                          ;add one, and add the substring to the end of Str1.
If expr(Str2              ;if we need to loop again, else end.
Goto 0                    ;for a further explanation of Str2, goto the end.
DelVar Str2               ;clean up variables used by this program.
DelVar R                  
DelVar X
DelVar Y
DelVar A
Func
Disp "Str1:
sub(Str1,2,length(Str1)-1\->\Str1   ;get rid of the space at the beginning of
                                    ;Str1
\stop83\

;First off, we store this to Str2 to tell the calculator to repeat the loop
;until A is equal to zero (in other words, the int(A) equals A because 0=0)
;"A\!=\int(A\->\Str2
;Note: the number of chars in A keeps decreasing because each time through
;the loop, A is multiplied by 10 and only the fractional part of A is kept.
;But if A is an integer, this won't always work. a number like 1,000 or 1230
;would become 1 or 123. So we need another test:
;If A=int(A		   ;if A is an integer...	
;"Y\!=\X\->\Str2           ;"Y does not equal X" store to Str2.
;Remember that X is how many times the number was decreased.  Y is the number
;of times it has been increased, so when they meet, the string is finished,
;and the program quits.
;See what you can use this for; I'm sure it has plenty of practical uses in
;new Basic programs :).