17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

HEX$ Function<br />

Purpose:<br />

To return a string which represents the hexadecimal value of the numeric argument.<br />

Syntax:<br />

v$=HEX$(x)<br />

Comments:<br />

HEX$ converts decimal values within the range of -32768 to +65535 into a hexadecimal string<br />

expression within the range of 0 to FFFF.<br />

Hexadecimal numbers are numbers to the base 16, rather than base 10 (decimal numbers).<br />

Appendix C and Appendix G in the GW-BASIC <strong>User's</strong> Guide contain more information on<br />

hexadecimals and their equivalents.<br />

x is rounded to an integer before HEX$(x) is evaluated. See the OCT$ function for octal<br />

conversions.<br />

If x is negative, 2's (binary) complement form is used.<br />

Examples:<br />

10 CLS: INPUT "INPUT DECIMAL NUMBER";X<br />

20 A$=HEX$(X)<br />

30 PRINT X "DECIMAL IS "A$" HEXADECIMAL"<br />

RUN<br />

INPUT DECIMAL NUMBER? 32<br />

32 DECIMAL IS 20 HEXADECIMAL<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/HEXS.html28/03/2004 21.29.29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!