next up previous contents
Next: Arrays and matrices Up: Programming Help Previous: User input

More about printing

   Instruction PRINT is used to print to the screen, and in a slightly modified version, to the file on the disk.

To print to the printer, use LPRINT instead of PRINT. In the latter case, to force the page out of the printer, end every printing job with LPRINT CHR$(12).

QBASIC provides sophisticated ways of controlling the text output by format, colors, location on the screen. In addition it does have graphic statements, as long as the computer has graphics card. But the only thing needed for us is the regular

PRINT "New value is X=";X

which outputs the string (in quotation marks) and the value New value is X=1.234

Occasionally we may want to do minimal ``format" through the semi-colon, or TAB().

PRINT ".";

To see the effect of the semi-colon, run the above statement in a loopgif. Then delete the semicolon, and run it again.

For professional formatting of output, look up the instruction PRINT USING "###.##" in any BASIC textbook (your public library is a good source!).



Send comment