[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
PRINT USING              Formatted Screen Display

 PRINT USING strexpr; exprlist [;]

    Displays one or more string or numeric expressions, in a specified
    format, on screen.

     strexpr    A string variable or constant specifying the format in
                which the data is to be printed (see below).

    exprlist    Numeric and/or string expressions to print. Each
                expression must be separated from the one after it by
                either a comma or a semicolon.

           ;    If included at the end of the statement, suppresses the
                usual carriage return and line feed.

    Formatting options:

    The following symbols may be used in strexpr:

      Symbol    Meaning

           !    Print only the first character of a string expression.

        \  \    Print only the first n characters of a string expression,
                where n is the number of spaces between the two
                backslashes. If n is larger than the number of characters
                in the string expression, QuickBASIC pads the string
                expression on the right with space characters.

           &    Print a string expression without reformatting it.

           .    Specifies the position of the decimal point in a numeric
                expression.

           #    A place-holder. If the numeric expression has more digits
                to the right of the decimal point than the format string
                has #s, QuickBASIC rounds. If the numeric expression has
                more digits to the left of the decimal point than the
                format string has #s, QuickBASIC prints all the digits to
                the left of the decimal point and also prints a percent
                sign (%) to the left of the number. If the numeric
                expression has fewer digits to the left of the decimal
                point than the format string has #s, QuickBASIC right-
                justifies the number; that is, it pads the number on the
                left with spaces. (But if there are any #s to the left of
                the decimal point in the format string, QuickBASIC always
                prints at least one digit--a 0 if necessary--to the left
                of the decimal point.)

           +    Print a plus or minus sign, as appropriate, to the left of
                the number. The sign is always printed immediately to the
                left of the number.

           -    Print a minus sign immediately to the right of a negative
                number (the minus sign should appear after the place
                holders in the format string).

          $$    Print a dollar sign immediately to the left of the number.
                The double dollar sign also acts as a place holder for two
                additional digits to the left of the decimal point, one of
                which is the dollar sign itself. The dollar sign cannot be
                prefixed to a number printed in exponential format.

          **    Fill any leading spaces with asterisks. The double
                asterisk also acts as a place holder for two additional
                digits to the left of the decimal point.

         **$    Print a dollar sign immediately to the left of the number,
                and fill any remaining leading spaces with asterisks. The
                combination of two asterisks and a dollar sign also acts
                as a place holder for three additional digits, one of
                which is the dollar sign.

        ^^^^    Print a number in exponential format. The four carets
                should appear after all place holders in the format
                string.

           _    Print next character as a literal. The combination _#, for
                example, allows you to include a number sign as a literal
                in your numeric format.

     [other]    Characters other than the foregoing may be included as
                literals in the format string. Thus, for example, a single
                dollar sign may be positioned to the left of a series of
                place holders (#s) to achieve vertically aligned dollar
                signs, and space characters may be placed at the right
                side of the format string to achieve horizontal separation
                between a series of numbers.

   ----------------------------------------------------------------------

      Notes:    QuickBASIC sends a carriage return-line feed pair after
                the last expression in a PRINT USING statement, unless the
                expression is followed by a semicolon.

                QuickBASIC assumes a maximum line length of 80 characters,
                unless a different value has been specified by means of a
                WIDTH statement. QuickBASIC sends a carriage return-line
                feed pair when the maximum line length has been reached.

                Double-precision numbers in IEEE format may have three-
                digit exponents. To print numbers with three-digit
                exponents, use five carets instead of four.

See Also: LPRINT LPRINT USING PRINT PRINT # PRINT # USING
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson