home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
DB
/
DB012A.ZIP
/
VPI1_330.ZIP
/
BIT.PRG
< prev
next >
Wrap
Text File
|
1991-12-30
|
1KB
|
40 lines
***************************************************************************
** BIT.PRG
** (C) Copyright 1990-92, Sub Rosa Publishing Inc.
**
** A demonstration program provided to VP-Info users.
** This program may be copied freely. If it is used in commercial code,
** please credit the source, Sub Rosa Publishing Inc.
**
** BIT demonstrates the use of BIT( function to generate the binary
** code for characters.
**
** BIT is compatible with all current versions of VP-Info.
**
** Sid Bursten and Bernie Melman
***************************************************************************
WINDOW
CLS
SET RAW ON ; eliminates spaces between listed output
DO WHILE t ; perpetual loop terminated by BREAK command
ACCEPT 'Enter a short string for binary representation: ' TO string
IF string=' '
BREAK
ENDIF
?
REPEAT (LEN(string)*8) TIMES VARYING position ; 8 bits * number of chars
BIT_VAL = IFF(BIT(string,position),1,0) ; note use of IFF( function
?? str(bit_val,1,0) ; .. and STR( to format output
IF MOD(position,8)=0 ; .. and MOD( to space between characters
IF col()>60
?
ELSE
?? ' '
ENDIF
ENDIF
ENDREPEAT
ENDDO
CHAIN samples
*
* *** end of BIT.PRG ***