home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
baslib2.zip
/
ASC-CHR.BAS
next >
Wrap
BASIC Source File
|
1987-03-27
|
2KB
|
86 lines
'ASC & CHR Function Demos By John Craig, Jeff Bretz
'Additional rwts & conversion toi Quickbasic 2.01 by Dennis Dreyer
'ASC-CHR.BAS
clear
view print 1 to 7
cls
locate 2,30:Print " "
locate 3,30,0:Print " ASC/CHR DEMO "
locate 4,30:Print " In Quickbasic 2.01 "
locate 5,30:Print " "
color 1,4,1:locate 6,30:Print " "
locate 1,30:Print " "
REPEAT:
view print 8 to 24
color 14,6:cls
locate 9, 27,0: Print " Selection Demo you desire."
locate 11,27:Print "1} ASC Demonastration"
locate 12,27:print "2} CHR Demonastration"
locate 13,27:print "3} To Quit Program"
locate 15,27:input "Enter (1 or 2) and press <ENTER> :-> ",ANS
If ANS = 1 then CALL PGMASC
IF ANS = 2 then CALL PGMCHR
if ans = 3 then color 15,0,0:view print:cls:end
GOTO REPEAT
SUB PGMASC STATIC
cls:Quote$=chr$(34)
locate 10,25,0:Print "Demonstration of the ASC function,"
locate 11,25,0:print "which produces the ASCII code number"
locate 12,25,0:print "for any character.":print
locate 14,25,0:print "Type any character ...":print
locate 16,25,0:print "Press <ESC> key to return to menu."
GETT:
K$=INKEY$
if K$=chr$(27) then goto RRETURN
if K$=chr$(13) then goto GETT
if K$=chr$(10) then goto GETT: ' {Traps Control M,L,Etc....
if K$=chr$(12) then goto GETT
if K$=chr$(11) then goto GETT
If K$ ="" then goto GETT
view print 20 to 22
cls
locate 20,25,0:Print "ASC (";QUOTE$;K$;QUOTE$;") = ";ASC(K$);
if len(K$) =2 then print ASC(right$(k$,1));
GOTO GETT
RRETURN:
end sub
SUB PGMCHR STATIC
cls:Quote$=chr$(34)
locate 10,25,0:Print "Demonstration of the CHR$ function,"
locate 11,25,0:print "which produces the character for"
locate 12,25,0:print "any ASCII number (0 to 255).":print
locate 14,25,0:print "Type any ASCII number ...":print
locate 16,25,0:print "Press <0> key to return to menu."
GETTT:
locate 20,25:INPUT "ASCII number & press <ENTER> ->: ";n
if n <0 or N>255 or N <> int(N) then goto GETTT
if N=0 then goto RRRETURN
view print 20 to 23
cls
locate 22,25:print "CHR$(";N;") = ";QUOTE$;CHR$(N);QUOTE$
GOTO GETTT
RRRETURN:
END SUB