Article ID: 73084 - Last Review: May 12, 2003 - Revision: 2.0 Differences Between GW-BASIC and QBasicThis article was previously published under Q73084 On This PageSUMMARY
This article lists the improvements in QBasic over GW-BASIC and some
of the major differences between the two.
MORE INFORMATION
QBasic is a subset of QuickBasic version 4.5. The QBasic online help
feature contains complete articles explaining version differences between
BASICA/GW-BASIC and QBasic, unsupported keywords, and converting BASICA
programs for use under QBasic.
QBasic provides a "Windows-like" environment supporting the use of a mouse. A menu bar across the top of the screen contains pull-down menu selections. QBasic provides a split screen. The upper portion of the screen is called the view window and is for program code; at the bottom of the screen, an "immediate" window allows testing of a programming instruction prior to including it in a program. With QBasic, you don't need to use line numbers. However, line numbers are supported. Also, QBasic now supports line "labels." These labels are not required on every line, however, but can be used to direct program flow. As a result, QBasic has no RENUM command such as that of GW-BASIC. For example: Line label "Bob:" or line number "10" are both valid. You can cut and paste examples of program code from the online help screen and place them directly into the view window for execution. QBasic uses IEEE floating point math, the industry standard. GW-BASIC uses the MBF math format. For more information on IEEE vs. Microsoft Binary Format, query on the following words:
Tutorial and IEEE and MBF
QBasic is a subset of QuickBasic 4.5. QuickBasic 4.0 and later will
support a math co-processor, however, QBasic does not.
QBasic uses P-code, which stands for "pseudo code," so called because it's very similar to compiled code, but it's not completely compiled. P-code retains just enough information -- the crucial last bits that real machine code loses -- for listing it on the screen in source code format and for any modifications you decide to make. Yet, because it looks almost like the output of a compiler, it runs almost as fast as you would expect an executable file to run. Consequently, you get all the advantages of using an interpreter with virtually no speed penalty and little size penalty. QBasic supports additional variable types: User-Defined Types, Fixed-Length Strings, and Long Integers. User-Defined TypesUse the type If the variable is: declaration character: ------------------- ---------------------- String $ Integer Regular % Long & Floating Point Single-precision ! Double-precision # Fixed-Length StringsA regular integer variable can store any whole number from -32768 through
Long IntegersA long integer variable can represent a whole number from -2,147,483,648 through 2,147,483,647. Use "&" to declare long integers.Example: employees& = 15000000 Example: speed!= 33.33333 Example: pi# = 3.141592654 QBasic allows error/event trapping:
File Conversion from GW-BASIC to QBasicTo use a GW-BASIC program in QBasic, you must first save the file in an ASCII text format.Example: SAVE: "PROGNAME.BAS",A. Converting a GW-BASIC Program to QBasicUse REMLINE.BAS included with MS-DOS for QBasic to remove line numbers from GW-BASIC programs. For more information, see the documentation provided at the beginning of REMLINE.BAS by opening the file in QBasic.To load GW-BASIC programs to QBasic, you must use the command "QBasic /MBF" when starting QBasic from the DOS prompt. APPLIES TO
| Article Translations
|