Q(uick)BASIC Function: OCT$
Quick View
OCT$
A string function that returns a string representing the octal value of the numeric argument
Worth knowing
Useful and cross-version information about the programming environments of QBasic and QuickBasic.
Syntax
- HEX$(numeric-expression&)
- OCT$(numeric-expression&)
Description/Parameter(s)
numeric-expression& | Any numeric expression. The expression is rounded to an integer or long integer before it is evaluated. |
Example
INPUT x
a$ = HEX$ (x)
b$ = OCT$ (x)
PRINT x; "decimal is "; a$; " hexadecimal and "; b$; " in octal."
Syntax
- OCT$(numeric-expression)
Description/Parameter(s)
The numeric-expression may be of any type. The numeric-expression is rounded to an integer or long integer before the OCT$ function evaluates it.
Example
This example displays the octal version of several decimal numbers.
PRINT "The octal representation of decimal 24 is " OCT$(24)
PRINT "The octal representation of decimal 55 is " OCT$(55)
PRINT "The octal representation of decimal 101 is " OCT$(101)
Sample Output:
The octal representation of decimal 24 is 30 The octal representation of decimal 55 is 67 The octal representation of decimal 101 is 145See also:
Syntax
- OCT$(numeric-expression)
Description/Parameter(s)
numeric-expression | A numeric expression of any type. |
- The numeric-expression is rounded to an integer or long integer before the OCT$ function evaluates it.
Example
This example uses the OCT$ function to display the octal version of several decimal numbers.
PRINT "The octal representation of decimal 24 is "; OCT$(24)
PRINT "The octal representation of decimal 55 is "; OCT$(55)
PRINT "The octal representation of decimal 101 is "; OCT$(101)
Sample Output:
The octal representation of decimal 24 is 30 The octal representation of decimal 55 is 67 The octal representation of decimal 101 is 145See also: